Skip to content

Commit

Permalink
Make WebIDL binder temp locals threadsafe (#22772)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouwe authored Oct 21, 2024
1 parent 8cce4db commit f88c213
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/webidl_binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ def make_call_args(i):
if non_pointer:
return_prefix += '&'
if copy:
pre += ' static %s temp;\n' % type_to_c(return_type, non_pointing=True)
# Avoid sharing this static temp var between threads, which could race.
pre += ' static thread_local %s temp;\n' % type_to_c(return_type, non_pointing=True)
return_prefix += '(temp = '
return_postfix += ', &temp)'

Expand Down

0 comments on commit f88c213

Please sign in to comment.