Skip to content

Commit 1c5cf47

Browse files
committed
Add no-op stubs of pthread condattr, rwlock, rwlockattr and spin functions when building with pthreads disabled. Closes #4130.
1 parent 81bb6af commit 1c5cf47

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

src/library_pthread_stub.js

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,20 @@ var LibraryPThreadStub = {
4141
// XXX implement if/when getpshared is required
4242
return 0;
4343
},
44-
pthread_cond_init: function() {},
45-
pthread_cond_destroy: function() {},
46-
pthread_cond_broadcast: function() {
47-
return 0;
48-
},
49-
pthread_cond_wait: function() {
50-
return 0;
51-
},
52-
pthread_cond_timedwait: function() {
53-
return 0;
54-
},
44+
pthread_cond_init: function() { return 0; },
45+
pthread_cond_destroy: function() { return 0; },
46+
pthread_cond_wait: function() { return 0; },
47+
pthread_cond_timedwait: function() { return 0; },
48+
pthread_cond_broadcast: function() { return 0; },
49+
pthread_cond_signal: function() { return 0; },
50+
51+
pthread_condattr_init: function() { return 0; },
52+
pthread_condattr_destroy: function() { return 0; },
53+
pthread_condattr_setclock: function() { return 0; },
54+
pthread_condattr_setpshared: function() { return 0; },
55+
pthread_condattr_getclock: function() { return 0; },
56+
pthread_condattr_getpshared: function() { return 0; },
57+
5558
pthread_self: function() {
5659
//FIXME: assumes only a single thread
5760
return 0;
@@ -136,9 +139,25 @@ var LibraryPThreadStub = {
136139
_pthread_cleanup_push.level = __ATEXIT__.length;
137140
},
138141

139-
pthread_rwlock_init: function() {
140-
return 0; // XXX
141-
},
142+
pthread_rwlock_init: function() { return 0; },
143+
pthread_rwlock_destroy: function() { return 0; },
144+
pthread_rwlock_rdlock: function() { return 0; },
145+
pthread_rwlock_tryrdlock: function() { return 0; },
146+
pthread_rwlock_timedrdlock: function() { return 0; },
147+
pthread_rwlock_wrlock: function() { return 0; },
148+
pthread_rwlock_trywrlock: function() { return 0; },
149+
pthread_rwlock_timedwrlock: function() { return 0; },
150+
151+
pthread_rwlockattr_init: function() { return 0; },
152+
pthread_rwlockattr_destroy: function() { return 0; },
153+
pthread_rwlockattr_setpshared: function() { return 0; },
154+
pthread_rwlockattr_getpshared: function() { return 0; },
155+
156+
pthread_spin_init: function() { return 0; },
157+
pthread_spin_destroy: function() { return 0; },
158+
pthread_spin_lock: function() { return 0; },
159+
pthread_spin_trylock: function() { return 0; },
160+
pthread_spin_unlock: function() { return 0; },
142161

143162
pthread_attr_setdetachstate: function() {},
144163

@@ -147,7 +166,6 @@ var LibraryPThreadStub = {
147166
},
148167
pthread_exit: function() {},
149168

150-
pthread_cond_signal: function() {},
151169
pthread_equal: function() {},
152170
pthread_join: function() {},
153171
pthread_detach: function() {},

0 commit comments

Comments
 (0)