Struct rustacuda::context::ContextStack
source · pub struct ContextStack;
Expand description
Type used to represent the thread-local context stack.
Implementations§
source§impl ContextStack
impl ContextStack
sourcepub fn pop() -> CudaResult<UnownedContext>
pub fn pop() -> CudaResult<UnownedContext>
Pop the current context off the stack and return the handle. That context may then be made current again (perhaps on a different CPU thread) by calling push.
Example:
let context = Context::create_and_push(ContextFlags::MAP_HOST | ContextFlags::SCHED_AUTO, device).unwrap();
let unowned = ContextStack::pop().unwrap();
sourcepub fn push<C: ContextHandle>(ctx: &C) -> CudaResult<()>
pub fn push<C: ContextHandle>(ctx: &C) -> CudaResult<()>
Push the given context to the top of the stack
Example:
let context = Context::create_and_push(ContextFlags::MAP_HOST | ContextFlags::SCHED_AUTO, device).unwrap();
let unowned = ContextStack::pop().unwrap();
ContextStack::push(&unowned).unwrap();