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 @@ -1318,18 +1318,16 @@ end
13181318
13191319using Random: randstring
13201320
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))
13321329 end
1330+ return nothing
13331331end
13341332
13351333function init_parallel()
You can’t perform that action at this time.
0 commit comments