[前][次][番号順一覧][スレッド一覧]

ruby-changes:67795

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 10 Sep 2021 20:02:03 +0900 (JST)
Subject: [ruby-changes:67795] 0ea157136f (master): postscript about rb_mutex_sleep

https://git.ruby-lang.org/ruby.git/commit/?id=0ea157136f

From 0ea157136f1b255321722db1acd0be3c6229a77a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Wed, 24 Mar 2021 09:21:58 +0900
Subject: postscript about rb_mutex_sleep

Asked ko1 about the design.  [ci skip]
---
 include/ruby/internal/intern/thread.h | 13 +++++++++++--
 template/Doxyfile.tmpl                |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/ruby/internal/intern/thread.h b/include/ruby/internal/intern/thread.h
index c9f4767..294e552 100644
--- a/include/ruby/internal/intern/thread.h
+++ b/include/ruby/internal/intern/thread.h
@@ -463,8 +463,17 @@ VALUE rb_mutex_unlock(VALUE mutex); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/thread.h#L463
  *
  * 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);
 
diff --git a/template/Doxyfile.tmpl b/template/Doxyfile.tmpl
index 0ace70b..15ecef3 100644
--- a/template/Doxyfile.tmpl
+++ b/template/Doxyfile.tmpl
@@ -280,6 +280,7 @@ ALIASES                = https://github.com/ruby/ruby/blob/trunk/template/Doxyfile.tmpl#L280
 ALIASES               += "alias{1}=Just another name of @ref \1"
 ALIASES               += "old{1}=Old name of @ref \1.^^@deprecated Use @ref \1 instead.^^@ingroup deprecated_macros"
 ALIASES               += "shyouhei=\@shyouhei"
+ALIASES               += "ko1=\@ko1"
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
 # only. Doxygen will then generate output that is more tailored for C. For
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]