Skip to content

Commit

Permalink
* thread_pthread.c (lock_func): should not check interrupts in
Browse files Browse the repository at this point in the history
  blocking region.  [ruby-dev:34378]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Apr 13, 2008
1 parent db0c3eb commit 31a060f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Sun Apr 13 18:52:27 2008 Nobuyoshi Nakada <[email protected]>

* thread_pthread.c (lock_func): should not check interrupts in
blocking region. [ruby-dev:34378]

Sat Apr 12 12:41:49 2008 Nobuyoshi Nakada <[email protected]>

* eval.c (ruby_exec_node, ruby_run_node), ruby.c (process_options):
Expand Down
22 changes: 13 additions & 9 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,23 +2317,23 @@ rb_mutex_trylock(VALUE self)
return locked;
}

static VALUE
static int
lock_func(rb_thread_t *th, mutex_t *mutex)
{
int interrupted = Qfalse;

native_mutex_lock(&mutex->lock);
while (mutex->th) {
while (mutex->th || (mutex->th = th, 0)) {
mutex->cond_waiting++;
native_cond_wait(&mutex->cond, &mutex->lock);

if (th->interrupt_flag) {
native_mutex_unlock(&mutex->lock);
RUBY_VM_CHECK_INTS();
native_mutex_lock(&mutex->lock);
interrupted = Qtrue;
break;
}
}
mutex->th = th;
native_mutex_unlock(&mutex->lock);
return Qnil;
return interrupted;
}

static void
Expand Down Expand Up @@ -2364,11 +2364,15 @@ rb_mutex_lock(VALUE self)
GetMutexPtr(self, mutex);

while (mutex->th != th) {
int interrupted;

BLOCKING_REGION({
lock_func(th, mutex);
interrupted = lock_func(th, mutex);
}, lock_interrupt, mutex);

RUBY_VM_CHECK_INTS();
if (interrupted) {
RUBY_VM_CHECK_INTS();
}
}
}
return self;
Expand Down
6 changes: 3 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-04-12"
#define RUBY_RELEASE_DATE "2008-04-13"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080412
#define RUBY_RELEASE_CODE 20080413
#define RUBY_PATCHLEVEL 0

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 4
#define RUBY_RELEASE_DAY 12
#define RUBY_RELEASE_DAY 13

#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Expand Down

0 comments on commit 31a060f

Please sign in to comment.