Re: what happens if

2012-03-21 Thread Erez D
2012/3/20 Diego Iastrubni > On יום שלישי 20 מרץ 2012 10:45:19 Erez D wrote: > > > All theory I read before implementing this said this was a bad idea. > The > > > theory says that libc may maintain some mutex inside malloc() which is > > > called > > > from printf() for example. This means that e

Re: what happens if

2012-03-20 Thread Diego Iastrubni
On יום שלישי 20 מרץ 2012 10:45:19 Erez D wrote: > > All theory I read before implementing this said this was a bad idea. The > > theory says that libc may maintain some mutex inside malloc() which is > > called > > from printf() for example. This means that even trivial things may kill > > your > >

Re: what happens if

2012-03-20 Thread Erez D
2012/3/19 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 ex

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 > > > f

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()

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

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. > >

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

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 "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 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 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 =}