Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with Thread function

Status
Not open for further replies.

goodtalka

Programmer
Jun 11, 2002
12
IN
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?
 
Have you compiled it as multi-threaded? Some compilers have a multithread flag (-mt?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top