what happens if

2012-03-19 Thread Erez D
what happens if i am running a multithreaded app ( 3 threads ) and one thread calls fork() ? ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Re: what happens if

2012-03-19 Thread Baruch Siach
Hi Erez, On Mon, Mar 19, 2012 at 10:47:20AM +0200, Erez D wrote: > what happens if i am running a multithreaded app ( 3 threads ) and one > thread calls fork() ? See pthread_atfork(3). baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}

Re: what happens if

2012-03-19 Thread ronys
FTFM: "The child process is created with a single thread - the one that called fork()." 2012/3/19 Erez D > what happens if i am running a multithreaded app ( 3 threads ) and one > thread calls fork() ? > > ___ > Linux-il mailing list > Linux-il@cs

Re: what happens if

2012-03-19 Thread Nadav Har'El
On Mon, Mar 19, 2012, Erez D wrote about "what happens if": > what happens if i am running a multithreaded app ( 3 threads ) and one > thread calls fork() ? On Linux, the new process will run ONLY a copy of the thread doing the fork(). The other threads are *not* copied to the child process. Ther

Re: what happens if

2012-03-19 Thread Erez D
On Mon, Mar 19, 2012 at 11:40 AM, Nadav Har'El wrote: > On Mon, Mar 19, 2012, Erez D wrote about "what happens if": > > what happens if i am running a multithreaded app ( 3 threads ) and one > > thread calls fork() ? > > On Linux, the new process will run ONLY a copy of the thread doing the > fork

Re: what happens if

2012-03-19 Thread Nadav Har'El
On Mon, Mar 19, 2012, Erez D wrote about "Re: what happens if": > my reason for fork is only for exec() - to protect the first program from > the other. Then you should be all fine. > the problem that may arise in forking a multithreaded is that one thread > may lock a mutex and then another call

Re: what happens if

2012-03-19 Thread Erez D
On Mon, Mar 19, 2012 at 12:20 PM, Nadav Har'El wrote: > On Mon, Mar 19, 2012, Erez D wrote about "Re: what happens if": > > my reason for fork is only for exec() - to protect the first program from > > the other. > > Then you should be all fine. > > > the problem that may arise in forking a multit

Re: what happens if

2012-03-19 Thread Nadav Har'El
On Mon, Mar 19, 2012, Erez D wrote about "Re: what happens if": > > If you're talking about the C language, you won't have any of these > > problems. System calls like close() or dup() do not use any pthread > > capabilities like mutexes. >.. > i will be using C++. are you sure this is safe ? I'm

Re: what happens if

2012-03-19 Thread Erez D
On Mon, Mar 19, 2012 at 12:25 PM, Nadav Har'El wrote: > On Mon, Mar 19, 2012, Erez D wrote about "Re: what happens if": > > > If you're talking about the C language, you won't have any of these > > > problems. System calls like close() or dup() do not use any pthread > > > capabilities like mutexe

Re: what happens if

2012-03-19 Thread Diego Iastrubni
On יום שני 19 מרץ 2012 12:22:15 Erez D wrote: > On Mon, Mar 19, 2012 at 12:20 PM, Nadav Har'El wrote: > > On Mon, Mar 19, 2012, Erez D wrote about "Re: what happens if": > > > my reason for fork is only for exec() - to protect the first program > > > from the other. > > > > Then you should be all