|
형변환으로 보낸 this 클래스 레퍼런스를 해당 함수에서 어떻게 읽어야 될련지..요..
아래를 보시면... 간단히 소스를 만들었는데...
scheduler.cc 에서는 this 로 넘어온 클래스 멤버 arg 에 접근 가능했지요.. 하지만
synchlist.cc 에서는 위에서 void 형으로 변환후 넘겼기에...평소대로 item->arg 뭐...이런건
안먹히잖습니까.. 어떻게 하면 넘어온 item 을 가지고..Thread 클래스의 arg 에 접근 가능하죠??
Thread.h //----- 이거 헤더..
class Thread{
public:
int arg;
}
Thread.cc //-----
void Thread::Fork(VoidFunctionPtr func, int a){
ReadyTorRun(This)
}
scheduler.cc---------//
ReadyToRun(Thread *thread){
int value = thread->arg; //이렇게 접근 할 수 있었는데...
Append((void *)thread); //이렇게 void 형으로 형변환하면..
}
synchlist.cc---------//
void Append(void *item){
//여기서는...arg 값 어떻게 읽나요??
// item->arg 이럴 수도 없고...
}
|