delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/29/05:05:28

From: newsham AT lava DOT net (Tim Newsham)
Subject: cygwin.dll src question: fork()
29 Oct 1997 05:05:28 -0800 :
Message-ID: <m0xQToy-0010xOC.cygnus.gnu-win32@malasada.lava.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Hi,

   Question: Why is a setjmp/longjmp pair used in __fork():

        static int
        __fork ()
        {
          jmp_buf b;
          int r;
        
          if ((r = setjmp (b)) != 0)
            {
              r = r == -2 ? -1 : r == -1 ? 0 : r;
              return r;
            }
        
          r = cygwin_fork_helper1 (u->data_start, u->data_end,
                                         u->bss_start, u->bss_end);
        
          /* Must convert result to get it through setjmp ok.  */
          longjmp (b, r == -1 ? -2 : r == 0 ? -1 : r);
        }

At the time when cygwin_fork_helper1() returns isn't the
child's state already a copy of the parent's state?

                                        Tim N.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019