Skip to content

Commit 325cb65

Browse files
committed
[embind] Only initialize pthread member in multi-threaded builds. NFC
Split out from emscripten-core#26487
1 parent c166734 commit 325cb65

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • system/include/emscripten

system/include/emscripten/val.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,11 @@ class EMBIND_VISIBILITY_DEFAULT val {
566566

567567
private:
568568
// takes ownership, assumes handle already incref'd and lives on the same thread
569-
explicit val(EM_VAL handle)
570-
: handle(handle), thread(pthread_self())
571-
{}
569+
explicit val(EM_VAL handle) :
570+
#ifdef _REENTRANT
571+
thread(pthread_self()),
572+
#endif
573+
handle(handle) {}
572574

573575
// Whether this value is a uses incref/decref (true) or is a special reserved
574576
// value (false).

0 commit comments

Comments
 (0)