ruby-changes:26514
From: nobu <ko1@a...>
Date: Sun, 23 Dec 2012 14:35:28 +0900 (JST)
Subject: [ruby-changes:26514] nobu:r38565 (trunk): thread.c: ignore result of blocking_region_begin
nobu 2012-12-23 14:35:15 +0900 (Sun, 23 Dec 2012) New Revision: 38565 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38565 Log: 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. Modified files: trunk/ChangeLog trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38564) +++ ChangeLog (revision 38565) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Dec 23 14:35:13 2012 Nobuyoshi Nakada <nobu@r...> + + * 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@s...> * lib/rubygems/commands/check_command.rb: Added --doctor and --dry-run Index: thread.c =================================================================== --- thread.c (revision 38564) +++ thread.c (revision 38565) @@ -124,10 +124,17 @@ static inline void blocking_region_end(r https://github.com/ruby/ruby/blob/trunk/thread.c#L124 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); \ }; \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/