summaryrefslogtreecommitdiff
path: root/ext/thread
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-26 02:20:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-26 02:20:26 +0000
commit1dd527012b5da0f7d84986a201c3b7f834adef78 (patch)
tree0f0fa30635fe967a05a490e407c600f173e51e3d /ext/thread
parentf3867e2203738c0ef5907e6b4251e780daa075c2 (diff)
downloadbundler-1dd527012b5da0f7d84986a201c3b7f834adef78.tar.gz
thread.c: undumpable
* ext/thread/thread.c (undumpable): ConditionVariable and Queue are not dumpable. [ruby-core:61677] [Bug #9674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/thread')
-rw-r--r--ext/thread/thread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/thread/thread.c b/ext/thread/thread.c
index cec8a5b4fa..38b8a8c4e7 100644
--- a/ext/thread/thread.c
+++ b/ext/thread/thread.c
@@ -534,6 +534,13 @@ rb_szqueue_num_waiting(VALUE self)
#define UNDER_THREAD 1
#endif
+static VALUE
+undumpable(VALUE obj)
+{
+ rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE, rb_obj_class(obj));
+ UNREACHABLE;
+}
+
void
Init_thread(void)
{
@@ -573,12 +580,14 @@ Init_thread(void)
rb_define_method(rb_cConditionVariable, "initialize", rb_condvar_initialize, 0);
rb_undef_method(rb_cConditionVariable, "initialize_copy");
+ rb_define_method(rb_cConditionVariable, "marshal_dump", undumpable, 0);
rb_define_method(rb_cConditionVariable, "wait", rb_condvar_wait, -1);
rb_define_method(rb_cConditionVariable, "signal", rb_condvar_signal, 0);
rb_define_method(rb_cConditionVariable, "broadcast", rb_condvar_broadcast, 0);
rb_define_method(rb_cQueue, "initialize", rb_queue_initialize, 0);
rb_undef_method(rb_cQueue, "initialize_copy");
+ rb_define_method(rb_cQueue, "marshal_dump", undumpable, 0);
rb_define_method(rb_cQueue, "push", rb_queue_push, 1);
rb_define_method(rb_cQueue, "pop", rb_queue_pop, -1);
rb_define_method(rb_cQueue, "empty?", rb_queue_empty_p, 0);