【发布时间】:2018-01-11 17:06:25
【问题描述】:
我正在C++ 中编写一个适用于线程的程序。当我尝试创建进程时,出现以下错误:Member function must be called or its address taken in function。这是我的代码:
void PCB::createProcess(){
asm cli
this->stack = new unsigned[stackSize];
stack[stackSize-1] = 0x200;
stack[stackSize-2] = FP_SEG(wrapper);
stack[stackSize-3] = FP_OFF(wrapper);
this->ss = FP_SEG(stack+stackSize-12);
this->sp = FP_OFF(stack+stackSize-12);
asm sti
}
void PCB::wrapper(){
myThread->run();
myThread->state = TERMINATED;
}
我在这两行中得到错误:
stack[stackSize-2] = FP_SEG(wrapper);
stack[stackSize-3] = FP_OFF(wrapper);
我什么都试过了。
我试过(&(wrapper))、PCB::wrapper、&PCB::wrapper 并没有任何帮助,它只会给我更多的错误。 PCB 是类的名称。
如果有人有想法,请帮忙。
【问题讨论】:
标签: c++ multithreading borland-c++ bcc-compiler