postgresql/src/test/thread
Tom Lane 732b33f8ae Fix up .gitignore and cleanup actions in some src/test/ subdirectories.
examples/, locale/, and thread/ lacked .gitignore files and were also
not connected up to top-level "make clean" etc.  This had escaped notice
because none of those directories are built in normal scenarios.  Still,
they have working Makefiles, so if someone does a "make" in one of these
directories it would be good if (a) git doesn't bleat about the product
files and (b) cleaning up removes them.

This is a longstanding oversight, but since this behavior is probably
only of interest to developers, there seems no need for back-patching.

Michael Paquier and Tom Lane
2015-04-24 17:13:06 -04:00
..
.gitignore Fix up .gitignore and cleanup actions in some src/test/ subdirectories. 2015-04-24 17:13:06 -04:00
Makefile
README
thread_test.c

src/test/thread/README

Threading
=========

This program is run by configure to determine if threading is
properly supported on the platform.

You can run the program manually to see details, which shows if your
native libc functions are thread-safe, or if we use *_r functions or
thread locking.

To use this program manually, you must:

	o run "configure"
	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 \
    -lws2_32 \
    -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.