Version française
Home     About     Download     Resources     Contact us    
Browse thread
timer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Anastasia Gornostaeva <ermine@e...>
Subject: Re: [Caml-list] timer
On Tue, Feb 01, 2005 at 09:50:35AM +0200, Ville-Pertti Keinonen wrote:

> > >  Module Timer
> > >  <http://pllab.kaist.ac.kr/%7Eshoh/ocaml/libs/timer/doc/type_Timer.html>
> > 
> > This module does not work when is compiled for native-code mode and is linked
> > with libc_r under FreeBSD 5.x 
> 
> Did you intentionally link against libc_r, or are you running a
> pre-stable version of 5.x?
> 
> libpthread is the default for FreeBSD 5.x since before becoming the
> stable branch and 6-current, and it should work correctly (verified for
> -current).

I have different FreeBSDs, 5.2rc2 and 5.3-release. 
On 5.2rc2 using libc_r is by default but just now I use libmap.conf only for 
ocaml-compiled programs to use pthreads. 
I still dont believe it is only freebsd related problem if i use 
freebsd 5.2rc2 for long time and with wide range of sowtware without 
problems. For example, on my machine there is running Zope based on python 2.1,
that is linked against libc_r. Well, i dont know if it uses signals ...

How can I reproduce this problem on C? A probram below does not lose signals

#include <signal.h>
#include <stdio.h>

void sig_handler(int s)
{
        // stderr is preferred because it is non-buffered
        fprintf(stderr, "Got signal: %d\n", s);
}

int main(int argc, char ** argv)
{
        printf("Starting...\n");
        signal(SIGALRM, sig_handler);
        signal(SIGUSR1, sig_handler);
        signal(SIGUSR2, sig_handler);
        printf("Handlers installed...\n");
        while(1)
        {
                if(!sleep(5))
                        fprintf(stderr, "tick!\n");
                else
                        perror("sleep");
        }
}

Compilation: 
gcc test.o -o test -pthread
gcc test.o -o test -lc_r
and playing with library mapping in libmap.conf
Using: run it ad manually send killall -SIGALRM test
All is fine.

ermine