From 81cf2be807181fc189703c04a7c149863f7bb631 Mon Sep 17 00:00:00 2001 From: thedarkone Date: Fri, 31 Jul 2015 06:49:59 +0200 Subject: [PATCH] load.c: unlock the new shield * load.c (load_lock): unlock the newly inserted shield. --- load.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/load.c b/load.c index 83fea37..b84a61d 100644 --- a/load.c +++ b/load.c @@ -748,7 +748,11 @@ load_lock(const char *ftptr) switch (rb_thread_shield_wait((VALUE)data)) { case Qfalse: data = (st_data_t)ftptr; - st_insert(loading_tbl, data, (st_data_t)rb_thread_shield_new()); + VALUE new_shield = rb_thread_shield_new(); + /* rb_thread_shield_new() automatically pre-locks the new shield, since this branch indicates + the failure to acquire the lock, the newly installed shield shouldn't be locked */ + rb_thread_shield_release(new_shield); + st_insert(loading_tbl, data, (st_data_t)new_shield); return 0; case Qnil: return 0; -- 1.8.2.3