diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 14:54:03 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 14:54:03 +0100 |
commit | f28cec576684a11234116c8cb1c63f61b146d1ca (patch) | |
tree | d10e6c12d8546d300a4dc568dabc2ed05a2979ec | |
parent | 11c33866cc5d3d850d33ac5422f84ecd850e8b6a (diff) |
pthread_cleanup_pop
-rw-r--r-- | src/library.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index 57ac5755..7fee938f 100644 --- a/src/library.js +++ b/src/library.js @@ -6407,9 +6407,15 @@ LibraryManager.library = { _pthread_key_create.keys[key] = value; }, - pthread_cleanup__deps: ['atexit'], pthread_cleanup_push: function(routine, arg) { - _atexit(routine, arg); + __ATEXIT__.push({ func: function() { FUNCTION_TABLE[routine](arg) } }) + _pthread_cleanup_push.level = __ATEXIT__.length; + }, + + pthread_cleanup_pop: function() { + assert(_pthread_cleanup_push.level == __ATEXIT__.length, 'cannot pop if something else added meanwhile!'); + __ATEXIT__.pop(); + _pthread_cleanup_push.level = __ATEXIT__.length; }, // ========================================================================== |