* file.c (rb_thread_flock): wrap the flock system call by

TRAP_BEG/TRAP_END to enable signals.  [ruby-dev:27122]

* ext/socket/socket.c (bsock_send): wrap the sendto and send system
  call by TRAP_BEG/TRAP_END to enable signals when writing to a socket
  which is full.  [ruby-dev:27132]

* io.c (rb_io_syswrite): wrap the write system call by
  TRAP_BEG/TRAP_END to run signal hander in syswrite method.
  [ruby-dev:27134]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2005-09-18 18:29:19 +00:00
Родитель 9af6e57230
Коммит 1ad103b7f8
4 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Mon Sep 19 03:17:48 2005 Tanaka Akira <akr@m17n.org>
* file.c (rb_thread_flock): wrap the flock system call by
TRAP_BEG/TRAP_END to enable signals. [ruby-dev:27122]
* ext/socket/socket.c (bsock_send): wrap the sendto and send system
call by TRAP_BEG/TRAP_END to enable signals when writing to a socket
which is full. [ruby-dev:27132]
* io.c (rb_io_syswrite): wrap the write system call by
TRAP_BEG/TRAP_END to run signal hander in syswrite method.
[ruby-dev:27134]
Sun Sep 18 02:10:47 2005 why the lucky stiff <why@ruby-lang.org> Sun Sep 18 02:10:47 2005 why the lucky stiff <why@ruby-lang.org>
* lib/yaml/rubytypes.rb: remove comments that are bungling up * lib/yaml/rubytypes.rb: remove comments that are bungling up

Просмотреть файл

@ -494,11 +494,15 @@ bsock_send(argc, argv, sock)
rb_thread_fd_writable(fd); rb_thread_fd_writable(fd);
retry: retry:
if (!NIL_P(to)) { if (!NIL_P(to)) {
TRAP_BEG;
n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags), n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags),
(struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len); (struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len);
TRAP_END;
} }
else { else {
TRAP_BEG;
n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags)); n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags));
TRAP_END;
} }
if (n < 0) { if (n < 0) {
if (rb_io_wait_writable(fd)) { if (rb_io_wait_writable(fd)) {

6
file.c
Просмотреть файл

@ -2884,7 +2884,11 @@ static int
rb_thread_flock(int fd, int op, OpenFile *fptr) rb_thread_flock(int fd, int op, OpenFile *fptr)
{ {
if (rb_thread_alone() || (op & LOCK_NB)) { if (rb_thread_alone() || (op & LOCK_NB)) {
return flock(fd, op); int ret;
TRAP_BEG;
ret = flock(fd, op);
TRAP_END;
return ret;
} }
op |= LOCK_NB; op |= LOCK_NB;
while (flock(fd, op) < 0) { while (flock(fd, op) < 0) {

2
io.c
Просмотреть файл

@ -2256,7 +2256,9 @@ rb_io_syswrite(VALUE io, VALUE str)
if (!rb_thread_fd_writable(fptr->fd)) { if (!rb_thread_fd_writable(fptr->fd)) {
rb_io_check_closed(fptr); rb_io_check_closed(fptr);
} }
TRAP_BEG;
n = write(fptr->fd, RSTRING(str)->ptr, RSTRING(str)->len); n = write(fptr->fd, RSTRING(str)->ptr, RSTRING(str)->len);
TRAP_END;
if (n == -1) rb_sys_fail(fptr->path); if (n == -1) rb_sys_fail(fptr->path);