hi,
I have written a client/server program using pthread. After I get a client connection request, I create a thread for that client(detached thread with system scope).
The start routine that is specified in the pthread_create function creates a object of a class and calls a function in that class.
The code looks some what like this ->
void *start_routine(void *ptr)
{
......
.....
abc object; //abc is a class
object.func(arg); //func() is a function in the class abc
....
}
When I run this program, the thread is created successfully, all the statements above the function call(in the above routine) executes,but it doesn't return from the function call, nor it executes that function(I have given some cout statements at the begining of the function for checking purpose, which is not printed).
I haven't used any mutexes or condition variables, since it is not required here. What wrong have I made?
I have written a client/server program using pthread. After I get a client connection request, I create a thread for that client(detached thread with system scope).
The start routine that is specified in the pthread_create function creates a object of a class and calls a function in that class.
The code looks some what like this ->
void *start_routine(void *ptr)
{
......
.....
abc object; //abc is a class
object.func(arg); //func() is a function in the class abc
....
}
When I run this program, the thread is created successfully, all the statements above the function call(in the above routine) executes,but it doesn't return from the function call, nor it executes that function(I have given some cout statements at the begining of the function for checking purpose, which is not printed).
I haven't used any mutexes or condition variables, since it is not required here. What wrong have I made?