summaryrefslogtreecommitdiff
path: root/include/ruby/internal/intern/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/internal/intern/thread.h')
-rw-r--r--include/ruby/internal/intern/thread.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/include/ruby/internal/intern/thread.h b/include/ruby/internal/intern/thread.h
index c9f476744a..4d87452745 100644
--- a/include/ruby/internal/intern/thread.h
+++ b/include/ruby/internal/intern/thread.h
@@ -46,7 +46,7 @@ void rb_thread_schedule(void);
*
* @param[in] fd A file descriptor.
* @exception rb_eIOError Closed stream.
- * @exception rb_eSystemCalleError Situations like EBADF.
+ * @exception rb_eSystemCallError Situations like EBADF.
*/
int rb_thread_wait_fd(int fd);
@@ -56,15 +56,15 @@ int rb_thread_wait_fd(int fd);
*
* @param[in] fd A file descriptor.
* @exception rb_eIOError Closed stream.
- * @exception rb_eSystemCalleError Situations like EBADF.
+ * @exception rb_eSystemCallError Situations like EBADF.
*/
int rb_thread_fd_writable(int fd);
/**
- * Notifies a closing of a file descriptor to other threads. Multiple threads
- * can wait for the given file descriptor at once. If such file descriptor is
- * closed, threads need to start propagating their exceptions. This is the API
- * to kick that process.
+ * This funciton is now a no-op. It was previously used to interrupt threads
+ * that were using the given file descriptor and wait for them to finish.
+ *
+ * @deprecated Use IO with RUBY_IO_MODE_EXTERNAL and `rb_io_close` instead.
*
* @param[in] fd A file descriptor.
* @note This function blocks until all the threads waiting for such fd
@@ -463,8 +463,17 @@ VALUE rb_mutex_unlock(VALUE mutex);
*
* This function is called from `ConditionVariable#wait`. So it is not a
* deprecated feature. However @shyouhei have never seen any similar mutex
- * primitive available in any other language than Ruby. Is this a right
- * design? Maybe isn't it too complex a primitive?
+ * primitive available in any other languages than Ruby.
+ *
+ * EDIT: In 2021, @shyouhei asked @ko1 in person about this API. He answered
+ * that it is his invention. The motivation behind its design is to eliminate
+ * needs of condition variables as primitives. Unlike other languages, Ruby's
+ * `ConditionVariable` class was written in pure-Ruby initially. We don't have
+ * to implement machine-native condition variables in assembly each time we
+ * port Ruby to a new architecture. This function made it possible. "I felt I
+ * was a genius when this idea came to me", said @ko1.
+ *
+ * `rb_cConditionVariable` is now written in C for speed, though.
*/
VALUE rb_mutex_sleep(VALUE self, VALUE timeout);