julia
0c2fb633 - RFC: Add a hook for detecting task switches.

Commit
5 years ago
RFC: Add a hook for detecting task switches. Certain libraries are configured using global or thread-local state instead of passing handles to every function. CUDA, for example, has a `cudaSetDevice` function that binds a device to the current thread for all future API calls. This is at odds with Julia's task-based concurrency, which presents an execution environment that's local to the current task (e.g., in the case of CUDA, using a different device). This PR adds a hook mechanism that can be used to detect task switches, and synchronize Julia's task-local environment with the library's global or thread-local state.
Author
Committer
Parents
Loading