anisha@linux-y3pi:~> g++ conditionVarTEST.cpp -Wall
conditionVarTEST.cpp: In function ‘int main()’:
conditionVarTEST.cpp:33:53: error: invalid conversion from ‘void*
(void *) &functionA
will cast your function pointer functionA
which is of type void (*)(void*)
to a simple void*
. The later can't be converted to the first again, so the compiler reports an error. This is one of the reasons why you shouldn't use C-style casts.
Use pthread_create (&A, NULL, functionA, NULL);
instead.
Also, the return type of a thread function should be void*
, not void
. So change void functionA(void*)
to void* functionA(void*)
.