Welcome to the Linux Foundation Forum!

Threads doubhts

I have few doubhts related to threads. Can you please clarify.

1. Is it possible to call fork() inside a thread.

2. Is it possible for a thread to create another thread.

Thanks

Kumar

Comments

  • woboyle
    woboyle Posts: 501
    1. Yes, but you may have some issues with file descriptors and/or sockets that are in use in the forked copy. However, if you are going to exec another application after the fork, then fine.
    2. Yes. After all, you can consider the main application as being a thread itself.
  • chekkizhar
    chekkizhar Posts: 182
    both things are possible kumar :-)

Categories

Upcoming Training