delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/21/19:21:45

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Sent: 21 May 2001 23:14:38 GMT
From: "Andrew de Quincey" <andrew AT orbital DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
Subject: Strange fork() behaviour under cygwin v1.3.1
Date: Tue, 22 May 2001 00:01:25 +0100
Message-ID: <HIEIJMBKKKLAMEGLLMOFOEMNCBAA.andrew@orbital.co.uk>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

Hi, I've been playing with the jabber server under win32... and I've run
into a slight problem. The following program illustrates it:

+++++++++++++++++++++++++++++++++++++++++++++++++
#include <pth.h>
#include <stdio.h>

void *test(void *arg);

int main(int argc, char* argv[]) {
  int pid;
  pth_init();

  pth_join(pth_spawn(PTH_ATTR_DEFAULT, test, NULL), NULL);
}

void *test(void *arg) {
  int pid;

  pid = fork();
  if (pid < 0) {
    printf("FORKFAILED\n");
  } else if (pid == 0) {
    printf("FORKCHILD\n");
  } else {
    printf("FORKPARENT\n");
  }
}
+++++++++++++++++++++++++++++++++++++++++++++++++

This outputs the following when run:
      0 [main] a 1760 sync_with_child: child 1524(0x23C) died before
initialization with status code 0x1
   2496 [main] a 1760 sync_with_child: *** child state waiting for longjmp
FORKFAILED


Is this a known problem, not being able to fork() once you are inside a
spawned thread? Or, is this a bug I have run across...?

BTW: I'm using cygwin dll 1.3.1, pth 1.4.0, and win2k SP1



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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