diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-24 00:26:52 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-24 00:26:52 +0000 |
commit | 3302b8fff571bfac2ac26376586d257f29fa44b3 (patch) | |
tree | 42b1b2b8aace93b164b42288cae9c2a133c4773d /thread_pthread.c | |
parent | a80eb26a188db79decadb82a459754c344dcf5a5 (diff) |
* include/ruby/intern.h (rb_strerrno): declared.
* template/known_errors.inc.tmpl: generate defined_error() and
undefined_error() instead of set_syserr.
* error.c (Init_syserr): define defined_error() and undefined_error()
to follow the above change.
(rb_strerrno): defined.
* thread_pthread.c: show error message and errno macro name with
rb_bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 0d37a12130..3e5e94dd26 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -34,7 +34,7 @@ native_mutex_lock(pthread_mutex_t *lock) { int r; if ((r = pthread_mutex_lock(lock)) != 0) { - rb_bug("pthread_mutex_lock: %d", r); + rb_bug("pthread_mutex_lock: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -43,7 +43,7 @@ native_mutex_unlock(pthread_mutex_t *lock) { int r; if ((r = pthread_mutex_unlock(lock)) != 0) { - rb_bug("native_mutex_unlock return non-zero: %d", r); + rb_bug("pthread_mutex_unlock: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -56,7 +56,7 @@ native_mutex_trylock(pthread_mutex_t *lock) return EBUSY; } else { - rb_bug("native_mutex_trylock return non-zero: %d", r); + rb_bug("pthread_mutex_trylock: %s (%s)", strerror(r), rb_strerrno(r)); } } return 0; @@ -67,7 +67,7 @@ native_mutex_initialize(pthread_mutex_t *lock) { int r = pthread_mutex_init(lock, 0); if (r != 0) { - rb_bug("native_mutex_initialize return non-zero: %d", r); + rb_bug("pthread_mutex_init: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -78,7 +78,7 @@ native_mutex_destroy(pthread_mutex_t *lock) { int r = pthread_mutex_destroy(lock); if (r != 0) { - rb_bug("native_mutex_destroy return non-zero: %d", r); + rb_bug("pthread_mutex_destroy: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -87,7 +87,7 @@ native_cond_initialize(pthread_cond_t *cond) { int r = pthread_cond_init(cond, 0); if (r != 0) { - rb_bug("native_cond_initialize return non-zero: %d", r); + rb_bug("pthread_cond_init: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -96,7 +96,7 @@ native_cond_destroy(pthread_cond_t *cond) { int r = pthread_cond_destroy(cond); if (r != 0) { - rb_bug("native_cond_destroy return non-zero: %d", r); + rb_bug("pthread_cond_destroy: %s (%s)", strerror(r), rb_strerrno(r)); } } @@ -304,7 +304,7 @@ ruby_init_stack(volatile VALUE *addr } #define CHECK_ERR(expr) \ - {int err = (expr); if (err) {rb_bug("err: %d - %s", err, #expr);}} + {int err = (expr); if (err) {rb_bug("%s: %s (%s)", #expr, strerror(err), rb_strerrno(err));}} static int native_thread_init_stack(rb_thread_t *th) @@ -621,7 +621,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv) thread_debug("native_sleep: pthread_cond_wait start\n"); r = pthread_cond_wait(&th->native_thread_data.sleep_cond, &th->interrupt_lock); - if (r) rb_bug("pthread_cond_wait: %d", r); + if (r) rb_bug("pthread_cond_wait: %s (%s)", strerror(r), rb_strerrno(r)); thread_debug("native_sleep: pthread_cond_wait end\n"); } else { @@ -630,7 +630,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv) (unsigned long)ts.tv_sec, ts.tv_nsec); r = pthread_cond_timedwait(&th->native_thread_data.sleep_cond, &th->interrupt_lock, &ts); - if (r && r != ETIMEDOUT) rb_bug("pthread_cond_timedwait: %d", r); + if (r && r != ETIMEDOUT) rb_bug("pthread_cond_timedwait: %s (%s)", strerror(r), rb_strerrno(r)); thread_debug("native_sleep: pthread_cond_timedwait end (%d)\n", r); } @@ -763,7 +763,7 @@ thread_timer(void *dummy) else if (err == 0 || err == EINTR) { if (rb_signal_buff_size() == 0) break; } - else rb_bug("thread_timer/timedwait: %d", err); + else rb_bug("thread_timer/timedwait: %s (%s)", strerror(err), rb_strerrno(err)); #if !defined(__CYGWIN__) && !defined(__SYMBIAN32__) if (signal_thread_list_anchor.next) { |