apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Martin <phi...@codematters.co.uk>
Subject Re: Reducing #ifdef burden on APR applications
Date Wed, 24 Aug 2005 17:10:09 GMT
Jeff Trawick <trawick@gmail.com> writes:

> Solaris will link in APR_SUCCESS-style no-op pthread functions if your
> application isn't built  thread-capable.

Glibc on Linux does the same for things like pthread_mutex_lock:

$ cat z.c
#include <pthread.h>
int main()
{
  if (pthread_mutex_lock(NULL))
    return 1;
  return 0;
}
$ gcc z.c              # build without threads
$ ./a.out
$ echo $?
0
$ gcc -pthread z.c     # with threads
$ ./a.out
Segmentation fault

> If APR always provides such APIs and acts like they work, what is to
> signal to a threaded APR app that they are picking up a non-threaded
> libapr?

Glibc doesn't provide no-op functions for things like
pthread_mutex_create, those are only available when the full threading
library replaces all the no-op functions.

-- 
Philip Martin

Mime
View raw message