summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-09 14:45:56 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-09 14:45:56 +0000
commit1fdbe0f437de59f87527818918b55d794a5fb92d (patch)
tree5debf417488a6637ce9fd12074e744fe24c73722 /thread.c
parent50a058b6beb55998b6d06b912bb8ffeb9131e6af (diff)
* gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
type check to get rid of a double free when main Thread has singleton class. [ruby-core:36741] [Bug #4828] * thread.c (rb_obj_is_mutex): add a new utility function. * vm.c (rb_obj_is_thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 1614bfe925..34f3ad8629 100644
--- a/thread.c
+++ b/thread.c
@@ -3350,6 +3350,17 @@ static const rb_data_type_t mutex_data_type = {
{mutex_mark, mutex_free, mutex_memsize,},
};
+VALUE
+rb_obj_is_mutex(VALUE obj)
+{
+ if (rb_typeddata_is_kind_of(obj, &mutex_data_type)) {
+ return Qtrue;
+ }
+ else {
+ return Qfalse;
+ }
+}
+
static VALUE
mutex_alloc(VALUE klass)
{