File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -1312,18 +1312,16 @@ end
1312
1312
1313
1313
using Random: randstring
1314
1314
1315
- let inited = false
1316
- # do initialization that's only needed when there is more than 1 processor
1317
- global function init_multi ()
1318
- if ! inited
1319
- inited = true
1320
- push! (Base. package_callbacks, _require_callback)
1321
- atexit (terminate_all_workers)
1322
- init_bind_addr ()
1323
- cluster_cookie (randstring (HDR_COOKIE_LEN))
1324
- end
1325
- return nothing
1315
+ # do initialization that's only needed when there is more than 1 processor
1316
+ const inited = Threads. Atomic {Bool} (false )
1317
+ function init_multi ()
1318
+ if ! Threads. atomic_cas! (inited, false , true )
1319
+ push! (Base. package_callbacks, _require_callback)
1320
+ atexit (terminate_all_workers)
1321
+ init_bind_addr ()
1322
+ cluster_cookie (randstring (HDR_COOKIE_LEN))
1326
1323
end
1324
+ return nothing
1327
1325
end
1328
1326
1329
1327
function init_parallel ()
You can’t perform that action at this time.
0 commit comments