Skip to content

Commit 7627e4e

Browse files
committed
[embind] Only initialize pthread member in multi-threaded builds. NFC
Split out from #26487
1 parent d36e8bc commit 7627e4e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

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).

test/codesize/test_minimal_runtime_code_size_hello_embind_val.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 371,
44
"a.js": 5353,
55
"a.js.gz": 2524,
6-
"a.wasm": 5798,
7-
"a.wasm.gz": 2731,
8-
"total": 11699,
9-
"total_gz": 5626
6+
"a.wasm": 5741,
7+
"a.wasm.gz": 2690,
8+
"total": 11642,
9+
"total_gz": 5585
1010
}

0 commit comments

Comments
 (0)