Thread: fork() inside a thread

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    4

    fork() inside a thread

    Hi all,

    It is possible to call a fork() cmd inside a thread?
    I couldn't find any documentation on this.

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Of course it's "possible".
    Whether it's a good idea or not remains to be seen.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    136
    what is the situation when u need(want) to fork a thread.
    S_ccess is waiting for u. Go Ahead, put u there.

  4. #4
    Day Dreamer
    Join Date
    Apr 2007
    Posts
    45
    If that is a question in general, yes definitely you can call fork inside a thread.

    If you dont have multiple threads in your code you call fork() from your main thread!
    So it isn't a requirement to specify about calling fork() from a thread as it doesn't have to do much with threads.
    But it remains to be seen whether calling fork() from a specific thread in your code effects the performance of your code or not.
    If you have a specific problem, do state it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 02-26-2009, 11:48 PM
  2. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 05:14 AM
  3. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 01:17 PM
  4. Messaging Between Threads, Exiting Thread On Demand, Etc.
    By HyperShadow in forum C++ Programming
    Replies: 10
    Last Post: 06-09-2007, 01:04 PM
  5. fork(), exit() - few questions!
    By s3t3c in forum C Programming
    Replies: 10
    Last Post: 11-30-2004, 06:58 AM