func NULL, 4- pthread_create - , .
func, NULL, :
extern "C" void *func(void *p) {
if (NULL == p)
return NULL;
Worker *w = reinterpret_cast<Worker*>(p);
w->run();
return NULL;
}
, +1 gdb, :
( , ), , func run Worker, NULL. (p=0x0) (this=0x0):
#2 0x0000000000400d26 in func (p=0x0) at ht19-4.cpp:57
#1 0x0000000000400fd5 in Worker::run (this=0x0) at ht19-4.cpp:40
Worker::run , counter, maxval m, Worker::wait()
#0 0x0000000000400f5a in Worker::wait (this=0x0) at ht19-4.cpp:30
Worker::wait() nth, null Worker, , , segfault.