1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* thread.c (rb_thread_call_without_gvl2): Note that ubf() may or may

not be called with the GVL.  Hinted that rb_thread_call_with_gvl()
  can be used to access ruby functionality.  [ruby-trunk - #6433]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-10-31 00:29:27 +00:00
parent 5562411c7f
commit 7ae466f134
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Wed Oct 31 09:28:24 2012 Eric Hodel <drbrain@segment7.net>
* thread.c (rb_thread_call_without_gvl2): Note that ubf() may or may
not be called with the GVL. Hinted that rb_thread_call_with_gvl()
can be used to access ruby functionality.
Wed Oct 31 09:06:54 2012 Eric Hodel <drbrain@segment7.net> Wed Oct 31 09:06:54 2012 Eric Hodel <drbrain@segment7.net>
* thread.c (rb_thread_call_without_gvl2): Update documentation to * thread.c (rb_thread_call_without_gvl2): Update documentation to

View file

@ -1100,7 +1100,9 @@ rb_thread_blocking_region_end(struct rb_blocking_region_buffer *region)
* *
* If another thread interrupts this thread (Thread#kill, signal delivery, * If another thread interrupts this thread (Thread#kill, signal delivery,
* VM-shutdown request, and so on), `ubf()' is called (`ubf()' means * VM-shutdown request, and so on), `ubf()' is called (`ubf()' means
* "un-blocking function"). `ubf()' should interrupt `func()' execution. * "un-blocking function"). `ubf()' should interrupt `func()' execution by
* toggling a cancellation flag, canceling the invocation of a call inside
* `func()' or similar. Note that `ubf()' may not be called with the GVL.
* *
* There are built-in ubfs and you can specify these ubfs: * There are built-in ubfs and you can specify these ubfs:
* *
@ -1143,15 +1145,17 @@ rb_thread_blocking_region_end(struct rb_blocking_region_buffer *region)
* NOTE: You can not execute most of Ruby C API and touch Ruby * NOTE: You can not execute most of Ruby C API and touch Ruby
* objects in `func()' and `ubf()', including raising an * objects in `func()' and `ubf()', including raising an
* exception, because current thread doesn't acquire GVL * exception, because current thread doesn't acquire GVL
* (cause synchronization problem). If you need to do it, * (it causes synchronization problems). If you need to
* read source code of C APIs and confirm by yourself. * call ruby functions either use rb_thread_call_with_gvl()
* or read source code of C APIs and confirm safety by
* yourself.
* *
* NOTE: In short, this API is difficult to use safely. I recommend you * NOTE: In short, this API is difficult to use safely. I recommend you
* use other ways if you have. We lack experiences to use this API. * use other ways if you have. We lack experiences to use this API.
* Please report your problem related on it. * Please report your problem related on it.
* *
* NOTE: Releasing GVL and re-acquiring GVL may be expensive operations * NOTE: Releasing GVL and re-acquiring GVL may be expensive operations
* for short running `func()'. Be sure to benchmark and use this * for a short running `func()'. Be sure to benchmark and use this
* mechanism when `func()' consumes enough time. * mechanism when `func()' consumes enough time.
* *
* Safe C API: * Safe C API: