Reputation: 2728
I have code like:
while(1) {
if(request == ACCEPT)
pthread_create(&t1, NULL, test_thread, NULL);
}
and test_thread code is like
void *test_thread(void * arg)
{
//never ending function
}
This working fine and didn't get any problem. But my question is there any problem if I run like this?
Upvotes: 1
Views: 1496
Reputation: 6608
You can create multiple threads with the same thread procedure. The only thing you have to worry about is the shared data (global/static variables, etc.).
Upvotes: 2