Subject: bug#14469: non-portable pthread in finalizers.c

From: Panicz Maciej Godek <[email-masked]>
Date: Sat, 25 May 2013 11:16:06 +0200

still hopelessly trying to build 2.0.9 on mingw,
using the up-to-date git master branch, and I keep
getting the following error:

finalizers.c: In function 'start_finalization_thread':
finalizers.c:259:7: error: wrong type argument to unary exclamation mark
finalizers.c: In function 'stop_finalization_thread':
finalizers.c:274:7: error: used struct type value where scalar is required
finalizers.c:279:27: error: incompatible types when assigning to type
'pthread_t' from type 'int'

here, the problem is that the code uses a non-portable feature of linux
pthreads, namely that pthread_t is implemented as an arithmetic type.
The manual page for pthread_self(3) states:

"POSIX.1 allows an implementation wide freedom in choosing the type used to
represent a thread ID; for example, representation using either an
arithmetic type or  a  structure  is  permitted.   Therefore, variables of
type pthread_t can't portably be compared using the C equality operator
(==); use pthread_equal(3) instead."

Mingw pthreads do make use of that freedom, and define pthread_t as a
struct, hence the code fails to compile.

As I browsed through bug-guile, and it seems to be a recurring issue, and
usually the proposed solution is to compile guile without threads, which is
not acceptable in my case.