diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2013-11-18 10:41:32 +0100 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2013-11-18 10:41:32 +0100 |
| commit | 6c7445ff5310993e00d6d3f226836a60378465fd (patch) | |
| tree | 85b6f52050e8f1ab6ef61dbb448b13edcd2516bc /src | |
| parent | 12a2a85e25578f8a2623c44150fb7e38615bc465 (diff) | |
| download | lanes-6c7445ff5310993e00d6d3f226836a60378465fd.tar.gz lanes-6c7445ff5310993e00d6d3f226836a60378465fd.tar.bz2 lanes-6c7445ff5310993e00d6d3f226836a60378465fd.zip | |
Fix a deadlock when GCing during a linda operation.
See issue #73.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keeper.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/keeper.c b/src/keeper.c index 9affbdf..418b5fb 100644 --- a/src/keeper.c +++ b/src/keeper.c | |||
| @@ -599,7 +599,9 @@ char const* init_keepers( lua_State* L) | |||
| 599 | lua_rawset( K, LUA_REGISTRYINDEX); | 599 | lua_rawset( K, LUA_REGISTRYINDEX); |
| 600 | 600 | ||
| 601 | STACK_END( K, 0); | 601 | STACK_END( K, 0); |
| 602 | MUTEX_INIT( &GKeepers[i].lock_); | 602 | // we can trigger a GC from inside keeper_call(), where a keeper is acquired |
| 603 | // from there, GC can collect a linda, which would acquire the keeper again, and deadlock the thread. | ||
| 604 | MUTEX_RECURSIVE_INIT( &GKeepers[i].lock_); | ||
| 603 | GKeepers[i].L = K; | 605 | GKeepers[i].L = K; |
| 604 | } | 606 | } |
| 605 | #if HAVE_KEEPER_ATEXIT_DESINIT | 607 | #if HAVE_KEEPER_ATEXIT_DESINIT |
