diff options
author | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 15:47:35 +0000 |
---|---|---|
committer | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 15:47:35 +0000 |
commit | 2251a2729af14db5b4bed694cfebb1fcc854009f (patch) | |
tree | e6bffe19ca6d0122d18a97e5344a7e03c64a0543 /ext/thread/thread.c | |
parent | c039c7081594a7e8e7cf5e96abbdc8fc6ac43a21 (diff) | |
download | ruby-2251a2729af14db5b4bed694cfebb1fcc854009f.tar.gz |
* ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc.
* ext/thread/thread.c (Init_thread): use rb_define_alias instead of
rb_alias to document alias.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/thread/thread.c')
-rw-r--r-- | ext/thread/thread.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/ext/thread/thread.c b/ext/thread/thread.c index 126b5b3523..b8be5d883f 100644 --- a/ext/thread/thread.c +++ b/ext/thread/thread.c @@ -216,7 +216,10 @@ queue_do_push(VALUE self, VALUE obj) /* * Document-method: Queue#push - * call-seq: push(object) + * call-seq: + * push(object) + * enq(object) + * <<(object) * * Pushes the given +object+ to the queue. */ @@ -294,7 +297,10 @@ queue_pop_should_block(int argc, VALUE *argv) /* * Document-method: Queue#pop - * call-seq: pop(non_block=false) + * call-seq: + * pop(non_block=false) + * deq(non_block=false) + * shift(non_block=false) * * Retrieves data from the queue. * @@ -338,6 +344,9 @@ rb_queue_clear(VALUE self) /* * Document-method: Queue#length + * call-seq: + * length + * size * * Returns the length of the queue. */ @@ -436,7 +445,10 @@ rb_szqueue_max_set(VALUE self, VALUE vmax) /* * Document-method: SizedQueue#push - * call-seq: push(object) + * call-seq: + * push(object) + * enq(object) + * <<(object) * * Pushes +object+ to the queue. * @@ -471,7 +483,10 @@ szqueue_do_pop(VALUE self, VALUE should_block) /* * Document-method: SizedQueue#pop - * call-seq: pop(non_block=false) + * call-seq: + * pop(non_block=false) + * deq(non_block=false) + * shift(non_block=false) * * Retrieves data from the queue. * @@ -555,11 +570,16 @@ Init_thread(void) rb_define_method(rb_cQueue, "length", rb_queue_length, 0); rb_define_method(rb_cQueue, "num_waiting", rb_queue_num_waiting, 0); - rb_alias(rb_cQueue, rb_intern("enq"), rb_intern("push")); - rb_alias(rb_cQueue, rb_intern("<<"), rb_intern("push")); - rb_alias(rb_cQueue, rb_intern("deq"), rb_intern("pop")); - rb_alias(rb_cQueue, rb_intern("shift"), rb_intern("pop")); - rb_alias(rb_cQueue, rb_intern("size"), rb_intern("length")); + /* Alias for #push. */ + rb_define_alias(rb_cQueue, "enq", "push"); + /* Alias for #push. */ + rb_define_alias(rb_cQueue, "<<", "push"); + /* Alias for #pop. */ + rb_define_alias(rb_cQueue, "deq", "pop"); + /* Alias for #pop. */ + rb_define_alias(rb_cQueue, "shift", "pop"); + /* Alias for #length. */ + rb_define_alias(rb_cQueue, "size", "length"); rb_define_method(rb_cSizedQueue, "initialize", rb_szqueue_initialize, 1); rb_define_method(rb_cSizedQueue, "max", rb_szqueue_max_get, 0); @@ -567,10 +587,15 @@ Init_thread(void) rb_define_method(rb_cSizedQueue, "push", rb_szqueue_push, 1); rb_define_method(rb_cSizedQueue, "pop", rb_szqueue_pop, -1); rb_define_method(rb_cSizedQueue, "num_waiting", rb_szqueue_num_waiting, 0); - rb_alias(rb_cSizedQueue, rb_intern("enq"), rb_intern("push")); - rb_alias(rb_cSizedQueue, rb_intern("<<"), rb_intern("push")); - rb_alias(rb_cSizedQueue, rb_intern("deq"), rb_intern("pop")); - rb_alias(rb_cSizedQueue, rb_intern("shift"), rb_intern("pop")); + + /* Alias for #push. */ + rb_define_alias(rb_cSizedQueue, "enq", "push"); + /* Alias for #push. */ + rb_define_alias(rb_cSizedQueue, "<<", "push"); + /* Alias for #pop. */ + rb_define_alias(rb_cSizedQueue, "deq", "pop"); + /* Alias for #pop. */ + rb_define_alias(rb_cSizedQueue, "shift", "pop"); rb_provide("thread.rb"); ALIAS_GLOBAL_CONST(ConditionVariable); |