Hi, I'm fiddling with the jabber server under cygwin...

Mostly everything works fine, except for one particular call to pth_fork()
(in fact, this is the ONLY call to pth_fork() in jabberd)

Anyway, the following test program illustrates the problem:

#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");
  }
}

It outputs:
      0 [main] a 1720 sync_with_child: child 1724(0x23C) died before
initialization with status code 0x1
   3530 [main] a 1720 sync_with_child: *** child state waiting for longjmp
FORKFAILED


Can anyone help me with this?

fork()/pth_fork() work fine, as long as they are called from the main thread
of a process.. However, if you try to call them from a different thread, the
above problem occurs.


______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to