postgresql/src/test/thread
Bruce Momjian 8b4ff8b6a1 Wording cleanup for error messages. Also change can't -> cannot.
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 19:10:30 +00:00
..
Makefile Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
README Move thread_test directory from /tools to /test so source-only tarballs 2006-02-04 01:00:02 +00:00
thread_test.c Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00

README

This program should be run by developers wishing to enable threading on
new platforms.

Run thread_test program to determine if your native libc functions are
thread-safe, or if we should use *_r functions or thread locking.

To use this program, you must:

	o run "configure --enable-thread-safety"
	o compile the main source tree
	o compile and run this program

If your platform requires special thread flags that are not tested by
/config/acx_pthread.m4, add PTHREAD_CFLAGS and PTHREAD_LIBS defines to 
your template/${port} file.

Windows Systems
===============

Windows systems do not vary in their thread-safeness in the same way that
other systems might, nor do they generally have pthreads installed, hence 
on Windows this test is skipped by the configure program (pthreads is 
required by the test program, but not PostgreSQL itself). If you do wish
to test your system however, you can do so as follows:

1) Install pthreads in you Mingw/Msys environment. You can download pthreads
   from ftp://sources.redhat.com/pub/pthreads-win32/.
   
2) Build the test program:

   gcc -o thread_test.exe \
    -D_REENTRANT \
    -D_THREAD_SAFE \
    -D_POSIX_PTHREAD_SEMANTICS \
    -I../../../src/include/port/win32 \
    thread_test.c \
    -lwsock32 \
    -lpthreadgc2

3) Run thread_test.exe. You should see output like:

    dpage@PC30:/cvs/pgsql/src/tools/thread$ ./thread_test
    Your GetLastError() is thread-safe.
    Your system uses strerror() which is thread-safe.
    getpwuid_r()/getpwuid() are not applicable to Win32 platforms.
    Your system uses gethostbyname which is thread-safe.

    Your platform is thread-safe.