ruby-changes:22243
From: nobu <ko1@a...>
Date: Fri, 13 Jan 2012 17:23:54 +0900 (JST)
Subject: [ruby-changes:22243] nobu:r34292 (trunk): * load.c (load_unlock): update loading table at once.
nobu 2012-01-13 17:23:43 +0900 (Fri, 13 Jan 2012) New Revision: 34292 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34292 Log: * load.c (load_unlock): update loading table at once. Modified files: trunk/ChangeLog trunk/load.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34291) +++ ChangeLog (revision 34292) @@ -1,3 +1,7 @@ +Fri Jan 13 17:23:38 2012 Nobuyoshi Nakada <nobu@r...> + + * load.c (load_unlock): update loading table at once. + Fri Jan 13 16:44:45 2012 Nobuyoshi Nakada <nobu@r...> * error.c (exc_equal): try implicit conversion for delegator. Index: load.c =================================================================== --- load.c (revision 34291) +++ load.c (revision 34292) @@ -416,22 +416,26 @@ return (char *)ftptr; } +static int +release_barrier(st_data_t key, st_data_t *value, st_data_t done) +{ + VALUE barrier = (VALUE)*value; + if (done ? rb_barrier_destroy(barrier) : rb_barrier_release(barrier)) { + /* still in-use */ + return ST_CONTINUE; + } + xfree((char *)key); + return ST_DELETE; +} + static void load_unlock(const char *ftptr, int done) { if (ftptr) { st_data_t key = (st_data_t)ftptr; - st_data_t data; st_table *loading_tbl = get_loading_table(); - VALUE barrier; - if (!st_lookup(loading_tbl, key, &data)) return; - barrier = (VALUE)data; - if (!(done ? rb_barrier_destroy(barrier) : rb_barrier_release(barrier))) { - if (st_delete(loading_tbl, &key, &data)) { - xfree((char *)key); - } - } + st_update(loading_tbl, key, release_barrier, done); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/