Hi !

Pth manual affirm that there is a distinct errno for each threads.
The source code attemps to save it into the context structure "error"
member.

But the following program, when tried with libpth 2.0.7 on Debian
lenny, on amd64, fails :

--- 8< ---
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <pth.h>

static void *child(void *dummy) {
        errno = 0;
        while (1) {
                pth_yield(NULL);
                assert(errno == 0);
                sleep(1);
        }
        return NULL;
}

int main(void) {
        pth_init();
        pth_spawn(PTH_ATTR_DEFAULT, child, NULL);
        errno = 1;
        while (1) {
                pth_yield(NULL);
                assert(errno == 1);
                sleep(1);
        }
        return 0;
}
--- >8 ---

The context sitch method guessed by configure on this system is swapcontext().
I cannot find in libpth source code where errno is saved when using this method.
Also, swapcontext manpage does not say that something is done about errno.

Am I wrong or does pth_mctx_switch() miss to save errno ?

______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            pth-users@gnu.org
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to