aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2013-02-26 20:07:59 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-26 20:07:59 -0500
commit0917076fb09f8625e51610646d51d734643be143 (patch)
tree39f910cf6efaea2b8480656415ff53f6d0df8540 /src/library.js
parent02b47dde8fd1ad6e39c7041ed8c0fb9adefbfcad (diff)
handle missing pthread key-values properly
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index d0f73fdd..955755ed 100644
--- a/src/library.js
+++ b/src/library.js
@@ -6743,11 +6743,12 @@ LibraryManager.library = {
pthread_key_create: function(key, destructor) {
if (!_pthread_key_create.keys) _pthread_key_create.keys = {};
- _pthread_key_create.keys[key] = null;
+ // values start at 0
+ _pthread_key_create.keys[key] = 0;
},
pthread_getspecific: function(key) {
- return _pthread_key_create.keys[key];
+ return _pthread_key_create.keys[key] || 0;
},
pthread_setspecific: function(key, value) {