Unless I'm confused (very possible) the program below shows a bug in pth
where a thread that calls pth_nap() is never woken up.

If you run the program, you'll see the thread go to sleep but never wake up.
This is with pth-1.3.7 running on FreeBSD.

-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

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

static void     *thread(void *arg);
static int      check_something(void *arg);

int
main(int ac, char **av)
{
        pth_event_t ev;

        pth_init();
        pth_spawn(NULL, thread, NULL);
        ev = pth_event(PTH_EVENT_FUNC, check_something, NULL, pth_time(2, 0));
        while (1)
                pth_wait(ev);
}

static void *
thread(void *arg)
{
        printf("thread sleeping five seconds...\n");
        pth_nap(pth_time(5, 0));
        printf("thread is done sleeping\n");
        return (NULL);
}

static int
check_something(void *arg)
{
        return (0);
}
______________________________________________________________________
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