Skip to content

Commit f88c213

Browse files
authored
Make WebIDL binder temp locals threadsafe (#22772)
1 parent 8cce4db commit f88c213

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/webidl_binder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ def make_call_args(i):
629629
if non_pointer:
630630
return_prefix += '&'
631631
if copy:
632-
pre += ' static %s temp;\n' % type_to_c(return_type, non_pointing=True)
632+
# Avoid sharing this static temp var between threads, which could race.
633+
pre += ' static thread_local %s temp;\n' % type_to_c(return_type, non_pointing=True)
633634
return_prefix += '(temp = '
634635
return_postfix += ', &temp)'
635636

0 commit comments

Comments
 (0)