Commit 50ab90a
authored
make get_threadpool thread safe (#14358)
Summary:
### Key Changes Made
making num_threads const ensures there is no data race.
### Benefits of This Fix
* **Eliminates the Data Race**: The tsan error should no longer occur
because the threadpool initialization is now atomic
* **Thread Safety**: Multiple threads can safely call `get_threadpool()`
concurrently
* **Maintains Compatibility**: All existing functionality is preserved
### Verification
* ✅ Code compiles without errors
* ✅ Buck build succeeds
* ✅ No diagnostic issues
* ✅ Maintains existing functionality
This fix should resolve the tsan failures encountered when running
assistant integration tests under ThreadSanitizer. The data race that
was occurring between threads T391 and T393 on the `num_threads`
variable at address `0x000016aa6cf0` should now be eliminated.
Differential Revision: D825606561 parent dc87d22 commit 50ab90a
1 file changed
+14
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
0 commit comments