diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-23 05:35:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-23 05:35:15 +0000 |
commit | 482bf47d1f54ade2052a5e8feb039134b510f1c6 (patch) | |
tree | b50a61f3a4b83b38a4f0e8cb7e03ede10e3e7588 | |
parent | 6fe32d72667945605ef710395706e04491bfd86a (diff) | |
download | ruby-482bf47d1f54ade2052a5e8feb039134b510f1c6.tar.gz |
thread.c: ignore result of blocking_region_begin
* thread.c (BLOCKING_REGION): if fail_if_interrupted is false ignore
the result of blocking_region_begin(), since it always is true in
that case. suppress "uninitialized" warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | thread.c | 9 |
2 files changed, 14 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Sun Dec 23 14:35:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * thread.c (BLOCKING_REGION): if fail_if_interrupted is false ignore + the result of blocking_region_begin(), since it always is true in + that case. suppress "uninitialized" warnings. + Sun Dec 23 09:34:07 2012 Eric Hodel <drbrain@segment7.net> * lib/rubygems/commands/check_command.rb: Added --doctor and --dry-run @@ -124,10 +124,17 @@ static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_regio rb_thread_set_current(_th_stored); \ } while(0) +#ifdef __GNUC__ +#define only_if_constant(expr, notconst) (__builtin_constant_p(expr) ? (expr) : (notconst)) +#else +#define only_if_constant(expr, notconst) notconst +#endif #define BLOCKING_REGION(exec, ubf, ubfarg, fail_if_interrupted) do { \ rb_thread_t *__th = GET_THREAD(); \ struct rb_blocking_region_buffer __region; \ - if (blocking_region_begin(__th, &__region, (ubf), (ubfarg), fail_if_interrupted)) { \ + if (blocking_region_begin(__th, &__region, (ubf), (ubfarg), fail_if_interrupted) || \ + /* always return true unless fail_if_interrupted */ \ + !only_if_constant(fail_if_interrupted, TRUE)) { \ exec; \ blocking_region_end(__th, &__region); \ }; \ |