* load.c (load_unlock): update loading table at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-01-13 08:23:43 +00:00
Родитель a5bfe7ca83
Коммит db02621bfb
2 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Fri Jan 13 17:23:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* load.c (load_unlock): update loading table at once.
Fri Jan 13 16:44:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (exc_equal): try implicit conversion for delegator.

22
load.c
Просмотреть файл

@ -416,22 +416,26 @@ load_lock(const char *ftptr)
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);
}
}