开发者

Can I create a pthread inside a pthread, which is already created by the main?

开发者 https://www.devze.com 2023-04-09 12:09 出处:网络
Will I run into an error if I create a pthread_create inside a pthread, which is created by 开发者_如何学编程the main function. If, I can then what all things I should take care of???

Will I run into an error if I create a pthread_create inside a pthread, which is created by 开发者_如何学编程the main function. If, I can then what all things I should take care of???

Important....:I am doing a socket programming, where I have opened 5 threads each on separate ports which are listening on ports, when ever I receive a message, I want to create a thread which takes the message and writes into a file using pwrite. So, I have a few questions, please can you help me???

If not then what is another solution of creating a thread inside a thread..??

Or will it give me a segmentation fault???

or will I run into some race conditions....


pthread_create creates a new thread. Independently of where it is called. And creating a new thread for a connection when listening on a port is pretty much standard procedure.

0

精彩评论

暂无评论...
验证码 换一张
取 消