delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/03/17/15:49:43

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: Alon Bar-Lev <alon DOT barlev AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Strange pthread_atfork() behavior
Date: Mon, 17 Mar 2008 22:48:45 +0200
User-Agent: KMail/1.9.9
MIME-Version: 1.0
Message-Id: <200803172248.47653.alon.barlev@gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hello,

Please CC my as I am not subscribed.

Just notice a difference between Linux and cygwin, hope
someone will be able to figure it out.

When running this program on Linux I get expected behavior.

When running under cygwin the exec program runs after about 60 seconds.
The following is the output:

__atfork_prepare
__atfork_parent
before sleep
__atfork_child
after sleep
<parent is not running anymore>
<wait about 60 seconds>
      56 [main] a 2952 sig_send: wait for sig_complete event failed, signal -34, rc 258, Win32 error 0 at child
<child output>

Any clue?

Regards,
Alon Bar-Lev.

---

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

static void __atfork_prepare  (void) {printf ("__atfork_prepare\n");}
static void __atfork_parent (void) {printf ("__atfork_parent\n");}
static void __atfork_child (void) {printf ("__atfork_child\n");}

int main (void) {
	pthread_atfork (__atfork_prepare, __atfork_parent, __atfork_child);

	if (fork () == 0) {
		printf ("at child\n");
		execl ("/bin/ls", "/bin/ls", NULL);
	}

	printf ("before sleep\n");
	sleep (10);
	printf ("after sleep\n");
}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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