This is a good compromise! Even less breaking, while still allowing people to use threadid()
if they know what they are doing. Completely safe with the previously officially-recommended use of it.
e.g.,
os_threadid() = #= current behavior of threadid() =#
function threadid()
if !current_task.sticky
error(
"You used `threadid()` in a non-sticky task. " *
"This is no longer supported as its abuse frequently results in silent cache corruption. " *
"If you meant to use this, please update to `Threads.os_threadid()`. " *
"Alternatively, use sticky threads: `Threads.@threads :sticky`."
)
end
return os_threadid() # Explicit call preferred, but allowed if sticky
end
Is there a possibility this won’t immediately get shot down if I open to a PR for this? Happy to do so and have triage consider it. @Oscar_Smith @mbauman