* io.c (rb_io_close): notify fd close before releasing gvl.
* io.c (fptr_finalize): modify fptr->mode before releasing gvl. remove unnecessary rb_thread_fd_close(). [Feature #4570] [ruby-core:35711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
252334e016
commit
4c10b36467
@ -1,3 +1,10 @@
|
|||||||
|
Mon Sep 10 01:36:00 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* io.c (rb_io_close): notify fd close before releasing gvl.
|
||||||
|
* io.c (fptr_finalize): modify fptr->mode before releasing gvl.
|
||||||
|
remove unnecessary rb_thread_fd_close().
|
||||||
|
[Feature #4570] [ruby-core:35711]
|
||||||
|
|
||||||
Mon Sep 10 00:16:34 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon Sep 10 00:16:34 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* process.c: exec() requires to be single threaded also on Haiku.
|
* process.c: exec() requires to be single threaded also on Haiku.
|
||||||
|
10
io.c
10
io.c
@ -3922,8 +3922,8 @@ fptr_finalize(rb_io_t *fptr, int noraise)
|
|||||||
|
|
||||||
fptr->fd = -1;
|
fptr->fd = -1;
|
||||||
fptr->stdio_file = 0;
|
fptr->stdio_file = 0;
|
||||||
if (!noraise)
|
fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
|
||||||
rb_thread_fd_close(fd);
|
|
||||||
if (IS_PREP_STDIO(fptr) || fd <= 2) {
|
if (IS_PREP_STDIO(fptr) || fd <= 2) {
|
||||||
/* need to keep FILE objects of stdin, stdout and stderr */
|
/* need to keep FILE objects of stdin, stdout and stderr */
|
||||||
}
|
}
|
||||||
@ -3940,7 +3940,6 @@ fptr_finalize(rb_io_t *fptr, int noraise)
|
|||||||
if ((maygvl_close(fd, noraise) < 0) && NIL_P(err))
|
if ((maygvl_close(fd, noraise) < 0) && NIL_P(err))
|
||||||
err = noraise ? Qtrue : INT2NUM(errno);
|
err = noraise ? Qtrue : INT2NUM(errno);
|
||||||
}
|
}
|
||||||
fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
|
|
||||||
|
|
||||||
if (!NIL_P(err) && !noraise) {
|
if (!NIL_P(err) && !noraise) {
|
||||||
switch(TYPE(err)) {
|
switch(TYPE(err)) {
|
||||||
@ -4052,13 +4051,8 @@ rb_io_close(VALUE io)
|
|||||||
if (fptr->fd < 0) return Qnil;
|
if (fptr->fd < 0) return Qnil;
|
||||||
|
|
||||||
fd = fptr->fd;
|
fd = fptr->fd;
|
||||||
#if defined __APPLE__ && (!defined(MAC_OS_X_VERSION_MIN_ALLOWED) || MAC_OS_X_VERSION_MIN_ALLOWED <= 1050)
|
|
||||||
/* close(2) on a fd which is being read by another thread causes
|
|
||||||
* deadlock on Mac OS X 10.5 */
|
|
||||||
rb_thread_fd_close(fd);
|
rb_thread_fd_close(fd);
|
||||||
#endif
|
|
||||||
rb_io_fptr_cleanup(fptr, FALSE);
|
rb_io_fptr_cleanup(fptr, FALSE);
|
||||||
rb_thread_fd_close(fd);
|
|
||||||
|
|
||||||
if (fptr->pid) {
|
if (fptr->pid) {
|
||||||
rb_last_status_clear();
|
rb_last_status_clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user