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