Skip to content

Commit

Permalink
* thread.c, thread_pthread.c: Moved pthread-specific preprocessor
Browse files Browse the repository at this point in the history
hacks to thread_pthread.c


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
yugui committed May 17, 2012
1 parent 1d7dc02 commit 82983e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Thu May 17 12:53:07 2012 Yuki Yugui Sonoda <yugui@google.com>

* thread.c, thread_pthread.c: Moved pthread-specific preprocessor
hacks to thread_pthread.c

Thu May 17 12:18:47 2012 Yuki Yugui Sonoda <yugui@google.com>

* io.c: Fix a mistake on merging the patch in the previous commit.
Expand Down
4 changes: 0 additions & 4 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -3303,9 +3303,7 @@ mutex_free(void *ptr)
if (err) rb_bug("%s", err);
}
native_mutex_destroy(&mutex->lock);
#ifdef HAVE_PTHREAD_COND_INITIALIZE
native_cond_destroy(&mutex->cond);
#endif
}
ruby_xfree(ptr);
}
Expand Down Expand Up @@ -3340,9 +3338,7 @@ mutex_alloc(VALUE klass)

obj = TypedData_Make_Struct(klass, rb_mutex_t, &mutex_data_type, mutex);
native_mutex_initialize(&mutex->lock);
#ifdef HAVE_PTHREAD_COND_INITIALIZE
native_cond_initialize(&mutex->cond, RB_CONDATTR_CLOCK_MONOTONIC);
#endif
return obj;
}

Expand Down
6 changes: 5 additions & 1 deletion thread_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ int pthread_condattr_init(pthread_condattr_t *attr);
static void
native_cond_initialize(rb_thread_cond_t *cond, int flags)
{
#ifdef HAVE_PTHREAD_COND_INITIALIZE
int r;
pthread_condattr_t attr;

Expand All @@ -266,15 +267,18 @@ native_cond_initialize(rb_thread_cond_t *cond, int flags)
}

return;
}
#endif
}

static void
native_cond_destroy(rb_thread_cond_t *cond)
{
#ifdef HAVE_PTHREAD_COND_INITIALIZE
int r = pthread_cond_destroy(&cond->cond);
if (r != 0) {
rb_bug_errno("pthread_cond_destroy", r);
}
#endif
}
#endif

Expand Down

0 comments on commit 82983e8

Please sign in to comment.