This patch seems to fix the problem below:

--- work/pth-1.3.7/pth_sched.c  Fri Mar 10 02:58:32 2000
+++ work.fixed/pth-1.3.7/pth_sched.c    Fri Feb 16 20:21:57 2001
@@ -763,8 +763,10 @@
     }
 
     /* perhaps we have to internally loop... */
-    if (loop_repeat)
+    if (loop_repeat) {
+        pth_time_set(now, PTH_TIME_NOW);
         goto loop_entry;
+    }
 
     pth_debug1("pth_sched_eventmanager: leaving");
     return;

-Archie

Archie Cobbs wrote:
> 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]

-- 
__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
______________________________________________________________________
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