【发布时间】:2014-11-25 20:46:04
【问题描述】:
如果我有课
class A{
A(){
getcontext(context);
makecontext(context, fun1, etc)
put context pointer on queue
}
fun1(args){
something
}
}
在我在 CPU1 上运行的 Thread1 中创建了一个类 A 的实例,然后尝试将上下文从队列中弹出并从 CPU2 上的 thread2 中交换,是否会出现问题,因为该对象是在堆栈中实例化的CPU1 中的 Thread1 以及因此被攻击到此上下文的 fun1 的指针无法访问?
【问题讨论】:
标签: c++ multithreading operating-system pthreads multicore