Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2006 15:19:28 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        threads@FreeBSD.org
Subject:   GHC 6.4.3 on FreeBSD (fwd)
Message-ID:  <20060807151829.T45647@fledge.watson.org>

next in thread | raw e-mail | index | archive | help

I've been talking to the Haskell folk about problems they've had getting their 
threaded runtime running on FreeBSD.  Here's one of their problem reports. 
Since I'm not up on how threads and signals are supposed to act, I can't 
confirm the below is a bug, of course, but figured you (experts) would be able 
to respond better.

Robert N M Watson
Computer Laboratory
University of Cambridge

---------- Forwarded message ----------
Date: Mon, 7 Aug 2006 15:12:19 +0100
From: Simon Marlow <simonmar@microsoft.com>
To: Volker Stolz <vs@foldr.org>, Robert Watson <rwatson@freebsd.org>,
     Kip Macy <kip.macy@gmail.com>
Cc: Simon Peyton-Jones <simonpj@microsoft.com>, Tony Finch <dot@dotat.at>,
     haskell@freebsd.org, glasgow-haskell-users@haskell.org
Subject: GHC 6.4.3 on FreeBSD

An update on the GHC/FreeBSD front: I didn't manage to reproduce the
reported threading bugs on a UP, will be trying on a MP shortly.

However, I did discover one odd case that libpthread doesn't appear to
handle properly, but libthr does.  This arose from a test in GHC's test
suite, but I've transliterated the code from Haskell to C:

$ cat thr1.c
#include <unistd.h>
#include <signal.h>
#include <pthread.h>

int main(int argc, char *argv[])
{
     sigset_t s;

     sigemptyset (&s);
     sigaddset(&s, SIGUSR1);
     sigprocmask(SIG_BLOCK, &s, NULL);
     pthread_kill(pthread_self(), SIGUSR1);
     sigpending(&s);
     printf("%x\n", s);
     exit(0);
}
$ gcc -pthread thr1.c
$ ./a.out
0
$ gcc -lthr thr1.c
$ ./a.out
20000000
$

This might (or might not) be related to the other threading issues with
GHC on FreeBSD.

Do you think we should link with -lthr by default on FreeBSD?  This
would be a trivial change to make, and given that GHC has its own
lightweight threading runtime, we probably aren't getting much from
having the KSE-based threading implementation anyway.

Cheers,
 	Simon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060807151829.T45647>