Updated pthreads library for the Windows platform (pthreads4w).

This commit is contained in:
LoRd_MuldeR 2022-03-23 00:39:28 +01:00
parent c32c85d8c9
commit a4aec9f3fe
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
26 changed files with 1712 additions and 766 deletions

View File

@ -0,0 +1,139 @@
Contributors (in approximate order of appearance)
[See also the ChangeLog file where individuals are
attributed in log entries. Likewise in the FAQ file.]
Ben Elliston bje at cygnus dot com
Initiated the project;
setup the project infrastructure (CVS, web page, etc.);
early prototype routines.
Ross Johnson Ross dot Johnson at dot homemail dot com dot au
early prototype routines;
ongoing project coordination/maintenance;
implementation of spin locks and barriers;
various enhancements;
bug fixes;
documentation;
testsuite.
Robert Colquhoun rjc at trump dot net dot au
Early bug fixes.
John E. Bossom john dot bossom at gmail dot com
Contributed substantial original working implementation;
bug fixes;
Anders Norlander anorland at hem2 dot passagen dot se
Early enhancements and runtime checking for supported
Win32 routines.
Tor Lillqvist tml at iki dot fi
General enhancements;
early bug fixes to condition variables.
Scott Lightner scott at curriculum dot com
Bug fix.
Kevin Ruland Kevin dot Ruland at anheuser-busch dot com
Various bug fixes.
Mike Russo miker at eai dot com
Bug fix.
Mark E. Armstrong avail at pacbell dot net
Bug fixes.
Lorin Hochstein lmh at xiphos dot ca
general bug fixes; bug fixes to condition variables.
Peter Slacik Peter dot Slacik at tatramed dot sk
Bug fixes.
Mumit Khan khan at xraylith dot wisc dot edu
Fixes to work with Mingw32.
Milan Gardian mg at tatramed dot sk
Bug fixes and reports/analyses of obscure problems.
Aurelio Medina aureliom at crt dot com
First implementation of read-write locks.
Graham Dumpleton Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au
Bug fix in condition variables.
Tristan Savatier tristan at mpegtv dot com
WinCE port.
Erik Hensema erik at hensema dot xs4all dot nl
Bug fixes.
Rich Peters rpeters at micro-magic dot com
Todd Owen towen at lucidcalm dot dropbear dot id dot au
Bug fixes to dll loading.
Jason Nye jnye at nbnet dot nb dot ca
Implementation of async cancellation.
Fred Forester fforest at eticomm dot net
Kevin D. Clark kclark at cabletron dot com
David Baggett dmb at itasoftware dot com
Bug fixes.
Paul Redondo paul at matchvision dot com
Scott McCaskill scott at 3dfx dot com
Bug fixes.
Jef Gearhart jgearhart at tpssys dot com
Bug fix.
Arthur Kantor akantor at bexusa dot com
Mutex enhancements.
Steven Reddie smr at essemer dot com dot au
Bug fix.
Alexander Terekhov TEREKHOV at de dot ibm dot com
Re-implemented and improved read-write locks;
(with Louis Thomas) re-implemented and improved
condition variables;
enhancements to semaphores;
enhancements to mutexes;
new mutex implementation in 'futex' style;
suggested a robust implementation of pthread_once
using a named mutex;
system clock change handling re CV timeouts;
bug fixes.
Thomas Pfaff tpfaff at gmx dot net
Changes to make C version usable with C++ applications;
re-implemented mutex routines to avoid Win32 mutexes
and TryEnterCriticalSection;
procedure to fix Mingw32 thread-safety issues.
Franco Bez franco dot bez at gmx dot de
procedure to fix Mingw32 thread-safety issues.
Louis Thomas lthomas at arbitrade dot com
(with Alexander Terekhov) re-implemented and improved
condition variables.
David Korn dgk at research dot att dot com
Ported to UWIN.
Phil Frisbie, Jr. phil at hawksoft dot com
Bug fix.
Ralf Brese Ralf dot Brese at pdb4 dot siemens dot de
Bug fix.
prionx at juno dot com prionx at juno dot com
Bug fixes.
Max Woodbury mtew at cds dot duke dot edu
POSIX versioning conditionals;
reduced namespace pollution;
idea to separate routines to reduce statically
linked image sizes.
Rob Fanner rfanner at stonethree dot com
Bug fix.
Michael Johnson michaelj at maine dot rr dot com
Bug fix.
Nicolas Barry boozai at yahoo dot com
Bug fixes.
Piet van Bruggen pietvb at newbridges dot nl
Bug fix.
Makoto Kato raven at oldskool dot jp
AMD64 port.
Panagiotis E. Hadjidoukas peh at hpclab dot ceid dot upatras dot gr
phadjido at cs dot uoi dot gr
Contributed the QueueUserAPCEx package which
makes preemptive async cancellation possible.
Will Bryant will dot bryant at ecosm dot com
Borland compiler patch and makefile.
Anuj Goyal anuj dot goyal at gmail dot com
Port to Digital Mars compiler.
Gottlob Frege gottlobfrege at gmail dot com
re-implemented pthread_once (version 2)
(pthread_once cancellation added by rpj).
Vladimir Kliatchko vladimir at kliatchko dot com
reimplemented pthread_once with the same form
as described by A.Terekhov (later version 2);
implementation of MCS (Mellor-Crummey/Scott) locks.
Ramiro Polla ramiro.polla at gmail dot com
static library auto init/cleanup on application
start/exit via RT hooks (MSC and GCC compilers only).
Daniel Richard G. skunk at iSKUNK dot org
Patches and cleanups for x86 and x64, particularly
across a range of MS build environments.
John Kamp john dot kamp at globalgraphics dot com
Patches to fix various problems on x64; brutal testing
particularly using high memory run environments.

View File

@ -0,0 +1,151 @@
Pthreads4w - a POSIX threads library for Microsoft Windows
This file is Copyrighted
------------------------
This file is covered under the following Copyright:
Copyright (C) 2001-2017 Ross P. Johnson
All rights reserved.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Pthreads4w is covered by the GNU Lesser General Public License
------------------------------------------------------------------
Pthreads4w is open software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation version 3 of the
License.
Pthreads4w is several binary link libraries, several modules,
associated interface definition files and scripts used to control
its compilation and installation.
Pthreads4w is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
A copy of the GNU Lesser General Public License is distributed with
Pthreads4w under the filename:
COPYING.FSF
You should have received a copy of the version 3 GNU Lesser General
Public License with Pthreads4w; if not, write to:
Free Software Foundation, Inc.
59 Temple Place
Suite 330
Boston, MA 02111-1307
USA
The contact addresses for Pthreads4w is as follows:
Homepage: http://sourceforge.net/projects/pthreads4w/
Email: Ross Johnson
Please use: Firstname.Lastname@homemail.com.au
Pthreads4w copyrights and exception files
---------------------------------------------
With the exception of the files listed below, Pthreads4w
is covered under the following GNU Lesser General Public License
Copyrights:
Pthreads4w - POSIX Threads Library for Win32
Copyright(C) 1998 John E. Bossom
Copyright(C) 1999,2017 Pthreads4w contributors
The current list of contributors is contained
in the file CONTRIBUTORS included with the source
code distribution. The current list of CONTRIBUTORS
can also be seen at the following WWW location:
https://sourceforge.net/projects/pthreads4w//contributors.html
Contact Email: Ross Johnson
Please use: Firstname.Lastname@homemail.com.au
These files are not covered under one of the Copyrights listed above:
COPYING
COPYING.FSF
tests/rwlock7.c
tests/rwlock8.c
tests/threestage.c
This file, COPYING, is distributed under the Copyright found at the
top of this file. It is important to note that you may distribute
verbatim copies of this file but you may not modify this file.
The file COPYING.FSF, which contains a copy of the version 3
GNU Lesser General Public License, is itself copyrighted by the
Free Software Foundation, Inc. Please note that the Free Software
Foundation, Inc. does NOT have a copyright over Pthreads4w,
only the COPYING.FSF that is supplied with Pthreads4w.
The file tests/rwlock7.c and tests/rwlock8.c are derived from code
written by Dave Butenhof for his book 'Programming With POSIX(R) Threads'.
The original code was obtained by free download from his website
http://home.earthlink.net/~anneart/family/Threads/source.html
and did not contain a copyright or author notice. It is assumed to
be freely distributable.
In all cases one may use and distribute these exception files freely.
And because one may freely distribute the LGPL covered files, the
entire Pthreads4w source may be freely used and distributed.
General Copyleft and License info
---------------------------------
For general information on Copylefts, see:
http://www.gnu.org/copyleft/
For information on GNU Lesser General Public Licenses, see:
http://www.gnu.org/copyleft/lesser.html
http://www.gnu.org/copyleft/lesser.txt
Why Pthreads4w did not use the GNU Lesser General Public License
--------------------------------------------------------------------
The goal of the Pthreads4w project has been to
provide a quality and complete implementation of the POSIX
threads API for Microsoft Windows within the limits imposed
by virtue of it being a stand-alone library and not
linked directly to other POSIX compliant libraries. For
example, some functions and features, such as those based
on POSIX signals, are missing.
Pthreads4w is a library, available in several different
versions depending on supported compilers, and may be used
as a dynamically linked module or a statically linked set of
binary modules. It is not an application on it's own.
It was fully intended that Pthreads4w be usable with
commercial software not covered by either the GPL or the LGPL
licenses. Pthreads4w has many contributors to it's
code base, many of whom have done so because they have
used the library in commercial or proprietry software
projects.
Releasing Pthreads4w under the LGPL ensures that the
library can be used widely, while at the same time ensures
that bug fixes and improvements to the Pthreads4w code
itself is returned to benefit all current and future users
of the library.
Although Pthreads4w makes it possible for applications
that use POSIX threads to be ported to Win32 platforms, the
broader goal of the project is to encourage the use of open
standards, and in particular, to make it just a little easier
for developers writing Win32 applications to consider
widening the potential market for their products.

View File

@ -0,0 +1,578 @@
Pthreads4w (A.K.A. PTHREADS4W)
==================================
Pthreads4w is free software, distributed under the GNU Lesser
General Public License (LGPL). See the file 'COPYING.LIB' for terms
and conditions. Also see the file 'COPYING' for information
specific to Pthreads4w, copyrights and the LGPL.
What is it?
-----------
Pthreads4w (a.k.a. pthreads4w) is an Open Source Software
implementation of the Threads component of the POSIX 1003.1c 1995
Standard (or later) for Microsoft's Windows environment. Some functions
from POSIX 1003.1b are also supported, including semaphores. Other
related functions include the set of read-write lock functions. The
library also supports some of the functionality of the Open
Group's Single Unix specification, namely mutex types, plus some common
and Pthreads4w specific non-portable routines (see README.NONPORTABLE).
See the file "ANNOUNCE" for more information including standards
conformance details and the list of supported and unsupported
routines.
Prerequisites
-------------
MSVC or GNU C (MinGW or MinGW64 with AutoConf Tools)
To build from source.
QueueUserAPCEx by Panagiotis E. Hadjidoukas
To support any thread cancellation in C++ library builds or
to support cancellation of blocked threads in any build.
This library is not required otherwise.
For true async cancellation of threads (including blocked threads).
This is a DLL and Windows driver that provides pre-emptive APC
by forcing threads into an alertable state when the APC is queued.
Both the DLL and driver are provided with the Pthreads4w.exe
self-unpacking ZIP, and on the Pthreads4w FTP site (in source
and pre-built forms). Currently this is a separate LGPL package to
Pthreads4w. See the README in the QueueUserAPCEx folder for
installation instructions.
Pthreads4w will automatically detect if the QueueUserAPCEx DLL
QuserEx.DLL is available and whether the driver AlertDrv.sys is
loaded. If it is not available, Pthreads4w will simulate async
cancellation, which means that it can async cancel only threads that
are runnable. The simulated async cancellation cannot cancel blocked
threads.
[FOR SECURITY] To be found Quserex.dll MUST be installed in the
Windows System Folder. This is not an unreasonable constraint given a
driver must also be installed and loaded at system startup.
Library naming
--------------
Because the library is being built using various exception
handling schemes and compilers - and because the library
may not work reliably if these are mixed in an application,
each different version of the library has it's own name.
Please do not distribute your own modified versions of the library
using names conforming to this description. You can use the
makefile variable "EXTRAVERSION" to append your own suffix to the
library names when building and testing your library.
Note 1: the incompatibility is really between EH implementations
of the different compilers. It should be possible to use the
standard C version from either compiler with C++ applications
built with a different compiler. If you use an EH version of
the library, then you must use the same compiler for the
application. This is another complication and dependency that
can be avoided by using only the standard C library version.
Note 2: if you use a standard C pthread*.dll with a C++
application, then any functions that you define that are
intended to be called via pthread_cleanup_push() must be
__cdecl.
Note 3: the intention was to also name either the VC or GC
version (it should be arbitrary) as pthread.dll, including
pthread.lib and libpthread.a as appropriate. This is no longer
likely to happen.
Note 4: the compatibility number (major version number) was
added so that applications can differentiate between binary
incompatible versions of the libs and dlls.
In general the naming format used is:
pthread[VG]{SE,CE,C}[c][E].dll
pthread[VG]{SE,CE,C}[c][E].lib
where:
[VG] indicates the compiler
V - MS VC, or
G - GNU C
{SE,CE,C} indicates the exception handling scheme
SE - Structured EH, or
CE - C++ EH, or
C - no exceptions - uses setjmp/longjmp
c - DLL major version number indicating ABI
compatibility with applications built against
a snapshot with the same major version number.
See 'Version numbering' below.
E - EXTRAVERSION suffix.
The name may also be suffixed by a 'd' to indicate a debugging version
of the library. E.g. pthreadVC2d.lib. These will be created e.g. when
the *-debug makefile targets are used.
Examples:
pthreadVC2.dll (MSVC/not dependent on exceptions - not binary
compatible with pthreadVC1.dll or pthreadVC.dll)
pthreadGC2-w32.dll (As built, e.g., by "make GC ARCH=-m32 EXTRAVERSION=-w32")
pthreadVC2-w64.dll (As built, e.g., by "nmake VC ARCH=-m64 EXTRAVERSION=-w64")
For information on ARCH (MinGW GNUmakefile) or TARGET_CPU (MSVS Makefile)
see the respective "Building with ..." sections below.
The GNU library archive file names have correspondingly changed, e.g.:
libpthreadGCE2.a
libpthreadGC2.a
libpthreadGC2-w64.a
Version numbering
-----------------
See pthread.h and the resource file 'version.rc'.
Microsoft version numbers use 4 integers:
0.0.0.0
Pthreads4w uses the first 3 following the standard major.minor.micro
system. We had claimed to follow the Libtool convention but this has
not been the case with recent releases. Binary compatibility and
consequently library file naming has not changed over this time either
so it should not cause any problems.
NOTE: Changes to the platform ABI can cause the library ABI to change
and the current version numbering system does not account for this.
The fourth is commonly used for the build number, but will be reserved
for future use.
major.minor.micro.0
The numbers are changed as follows:
1. If the general binary interface (ABI) has changed at all since the
last update in a way that requires recompilation and relinking of
applications, then increment Major, and set both minor and micro to 0.
(`M:m:u' becomes `M+1:0:0')
2. If the general API has changed at all since the last update or
there have been semantic/behaviour changes (bug fixes etc) but does
not require recompilation of existing applications, then increment
minor and set micro to 0.
(`M:m:u' becomes `M:m+1:0')
3. If there have been no interface or semantic changes since the last
public release but a new release is deemed necessary for some reason,
then increment micro.
(`M:m:u' becomes `M:m:u+1')
DLL compatibility numbering is an attempt to ensure that applications
always load a compatible Pthreads4w DLL by using a DLL naming system
that is consistent with the version numbering system. It also allows
older and newer DLLs to coexist in the same filesystem so that older
applications can continue to be used. For pre .NET Windows systems,
this inevitably requires incompatible versions of the same DLLs to have
different names.
Pthreads4w has adopted the Cygwin convention of appending a single
integer number to the DLL name. The number used is simply the library's
major version number.
Consequently, DLL name/s will only change when the DLL's
backwards compatibility changes. Note that the addition of new
'interfaces' will not of itself change the DLL's compatibility for older
applications.
Which of the several dll versions to use?
-----------------------------------------
or,
---
What are all these pthread*.dll and pthread*.lib files?
-------------------------------------------------------
Simple, use either pthreadGCc.* if you use GCC, or pthreadVCc.* if you
use MSVC - where 'c' is the DLL versioning (compatibility) number.
Otherwise, you need to choose carefully and know WHY.
The most important choice you need to make is whether to use a
version that uses exceptions internally, or not. There are versions
of the library that use exceptions as part of the thread
cancellation and exit implementation. The default version uses
setjmp/longjmp.
If you use either pthreadVCE[2] or pthreadGCE[2]:
1. [See also the discussion in the FAQ file - Q2, Q4, and Q5]
If your application contains catch(...) blocks in your POSIX
threads then you will need to replace the "catch(...)" with the macro
"PtW32Catch", eg.
#ifdef PtW32Catch
PtW32Catch {
...
}
#else
catch(...) {
...
}
#endif
Otherwise neither pthreads cancellation nor pthread_exit() will work
reliably when using versions of the library that use C++ exceptions
for cancellation and thread exit.
NB: [lib]pthreadGCE[2] does not support asynchronous cancellation. Any
attempt to cancel a thread set for asynchronous cancellation using
this version of the library will cause the applicaton to terminate.
We believe this is due to the "unmanaged" context switch that is
disrupting the stack unwinding mechanism and which is used
to cancel blocked threads. See pthread_cancel.c
Other name changes
------------------
All snapshots prior to and including snapshot 2000-08-13
used "_pthread_" as the prefix to library internal
functions, and "_PTHREAD_" to many library internal
macros. These have now been changed to "ptw32_" and "PTW32_"
respectively so as to not conflict with the ANSI standard's
reservation of identifiers beginning with "_" and "__" for
use by compiler implementations only.
If you have written any applications and you are linking
statically with the Pthreads4w library then you may have
included a call to _pthread_processInitialize. You will
now have to change that to ptw32_processInitialize.
Cleanup code default style
--------------------------
Previously, if not defined, the cleanup style was determined automatically
from the compiler used, and one of the following was defined accordingly:
__CLEANUP_SEH MSVC only
__CLEANUP_CXX C++, including MSVC++, GNU G++
__CLEANUP_C C, including GNU GCC, not MSVC
These defines determine the style of cleanup (see pthread.h) and,
most importantly, the way that cancellation and thread exit (via
pthread_exit) is performed (see the routine ptw32_throw()).
In short, the exceptions versions of the library throw an exception
when a thread is canceled, or exits via pthread_exit(). This exception is
caught by a handler in the thread startup routine, so that the
the correct stack unwinding occurs regardless of where the thread
is when it's canceled or exits via pthread_exit().
In this snapshot, unless the build explicitly defines (e.g. via a
compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then
the build NOW always defaults to __CLEANUP_C style cleanup. This style
uses setjmp/longjmp in the cancellation and pthread_exit implementations,
and therefore won't do stack unwinding even when linked to applications
that have it (e.g. C++ apps). This is for consistency with most/all
commercial Unix POSIX threads implementations.
Although it was not clearly documented before, it is still necessary to
build your application using the same __CLEANUP_* define as was
used for the version of the library that you link with, so that the
correct parts of pthread.h are included. That is, the possible
defines require the following library versions:
__CLEANUP_SEH pthreadVSE.dll
__CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll
__CLEANUP_C pthreadVC.dll or pthreadGC.dll
It is recommended that you let pthread.h use it's default __CLEANUP_C
for both library and application builds. That is, don't define any of
the above, and then link with pthreadVC.lib (MSVC or MSVC++) and
libpthreadGC.a (MinGW GCC or G++). The reason is explained below, but
another reason is that the prebuilt pthreadVCE.dll is currently broken.
Versions built with MSVC++ later than version 6 may not be broken, but I
can't verify this yet.
WHY ARE WE MAKING THE DEFAULT STYLE LESS EXCEPTION-FRIENDLY?
Because no commercial Unix POSIX threads implementation allows you to
choose to have stack unwinding. Therefore, providing it in pthread-win32
as a default is dangerous. We still provide the choice but unless
you consciously choose to do otherwise, your pthreads applications will
now run or crash in similar ways irrespective of the pthreads platform
you use. Or at least this is the hope.
Development Build Toolchains and Configurations
-----------------------------------------------
As of Release 2.10 all build configurations pass the full test suite
for the following toolchains and configurations:
All DLL and static library build targets enabled in the makefiles:
VC, VCE, VSE (DLL, inlined statics only)
GC, GCE (DLL, inlined and small statics)
MSVS:
Intel Core i7 (6 Core HT)
Windows 7 64 bit
MSVS 2010 Express with SDK 7.1 (using the SDK command shell TARGET_CPU = x64 or x86)
MSVS 2013 Express Cross Tools for x64 Command Prompt
MSVS 2013 Express Native Tools for x32 Command Prompt
GNU:
Intel Core i7 (6 Core HT)
Windows 7 64 bit
MinGW64 multilib enabled (ARCH = -m64 or -m32)
MinGW64 multilib disabled
Building with MS Visual Studio (C, VC++ using C++ EH, or Structured EH)
-----------------------------------------------------------------------
NOTE: A VS project/solution/whatever file is included as a contributed
work and is not used of maintained in development. All building and
testing is done using makefiles. We use the native make system for each
toolchain, which is 'nmake' in this case.
From the source directory run nmake without any arguments to list
help information. E.g.
$ nmake
As examples, as at Release 2.10 the pre-built DLLs and static libraries
can be built using one of the following command-lines:
[Note: "setenv" comes with the SDK which is not required to build the library.
I use it to build and test both 64 and 32 bit versions of the library.
"/2003" is used to override my build system which is Win7 (at the time of
writing) for backwards compatibility.]
$ setenv /x64 /2003 /Release
$ nmake realclean VC
$ nmake realclean VCE
$ nmake realclean VSE
$ nmake realclean VC-static
$ nmake realclean VCE-static
$ nmake realclean VSE-static
$ setenv /x86 /2003 /Release
$ nmake realclean VC
$ nmake realclean VCE
$ nmake realclean VSE
$ nmake realclean VC-static
$ nmake realclean VCE-static
$ nmake realclean VSE-static
If you want to differentiate or customise library naming you can use,
e.g.:
$ nmake realclean VC EXTRAVERSION="-w64"
The string provided via the variable EXTRAVERSION is appended to the dll
and .lib library names, e.g.:
pthreadVC2-w64.dll
pthreadVC2-w64.lib
To build and test all DLLs and static lib compatibility versions
(VC, VCE, VSE):
$ setenv /x64 /2003 /release
$ nmake all-tests
You can run the testsuite by changing to the "tests" directory and
running nmake. E.g.:
$ cd tests
$ nmake VC
Note: the EXTRAVERSION="..." option is passed to the tests Makefile
when you target "all-tests". If you build the library then change to the
tests directory to run the tests you will need to repeat the option
explicitly to the test "nmake" command-line.
For failure analysis etc. individual tests can be built
and run, e.g:
$ cd tests
$ nmake VC TESTS="foo bar"
This builds and runs all prerequisite tests as well as the individual
tests listed. Prerequisite tests are defined in tests\runorder.mk.
To build and run only the tests listed use:
$ cd tests
$ nmake VC NO_DEPS=1 TESTS="foo bar"
Building with MinGW
-------------------
NOTE: All building and testing is done using makefiles. We use the native
make system for each toolchain, which is 'make' in this case.
We have found that Mingw builds of the GCE library variants can fail when
run on 64 bit systems, believed to be due to the DWARF2 exception handling
being a 32 bit mechanism. The GC variants are fine. MinGW64 offers
SJLJ or SEH exception handling so choose one of those.
From the source directory:
run 'autoheader' to rewrite the config.h file
run 'autoconf' to rewrite the GNUmakefiles (library and tests)
run './configure' to create config.h and GNUmakefile.
run 'make' without arguments to list possible targets.
E.g.
$ autoheader
$ autoconf
$ ./configure
$ make realclean all-tests
With MinGW64 multilib installed the following variables can be defined
either on the make command line or in the shell environment:
ARCH
- possible values are "-m64" and "-m32". You will probably recognise
these as gcc flags however the GNUmakefile also converts these into
the appropriate windres options when building version.o.
As examples, as at Release 2.10 the pre-built DLLs and static libraries
are built from the following command-lines:
$ nmake realclean GC ARCH=-m64
$ nmake realclean GC ARCH=-m32
$ nmake realclean GCE ARCH=-m64
$ nmake realclean GCE ARCH=-m32
$ nmake realclean GC-static ARCH=-m64
$ nmake realclean GC-static ARCH=-m32
$ nmake realclean GCE-static ARCH=-m64
$ nmake realclean GCE-static ARCH=-m32
If you want to differentiate between libraries by their names you can use,
e.g.:
$ make realclean GC ARCH="-m64" EXTRAVERSION="-w64"
The string provided via the variable EXTRAVERSION is appended to the dll
and .a library names, e.g.:
pthreadGC2-w64.dll
libpthreadGC2-w64.a
To build and test all DLLs and static lib compatibility variants (GC, GCE):
$ make all-tests
or, with MinGW64 (multilib enabled):
$ make all-tests ARCH=-m64
$ make all-tests ARCH=-m32
You can run the testsuite by changing to the "tests" directory and
running make. E.g.:
$ cd tests
$ make GC
Note that the ARCH="..." and/or EXTRAVERSION="..." options are passed to the
tests GNUmakefile when you target "all-tests". If you change to the tests
directory and run the tests you will need to repeat those options explicitly
to the test "make" command-line.
For failure analysis etc. individual tests can be built and run, e.g:
$ cd tests
$ make GC TESTS="foo bar"
This builds and runs all prerequisite tests as well as the individual
tests listed. Prerequisite tests are defined in tests\runorder.mk.
To build and run only those tests listed use:
$ cd tests
$ make GC NO_DEPS=1 TESTS="foo bar"
Building under Linux using the MinGW cross development tools
------------------------------------------------------------
You can build the library on Linux by using the MinGW cross development
toolchain. See http://www.libsdl.org/extras/win32/cross/ for tools and
info. The GNUmakefile contains some support for this, for example:
make CROSS=i386-mingw32msvc- clean GC
will build pthreadGCn.dll and libpthreadGCn.a (n=version#), provided your
cross-tools/bin directory is in your PATH (or use the cross-make.sh script
at the URL above).
Building the library as a statically linkable library
-----------------------------------------------------
General: PTW32_STATIC_LIB must be defined for both the library build and the
application build. The makefiles supplied and used by the following 'make'
command lines will define this for you.
MSVC (creates pthreadVCn.lib as a static link lib):
nmake clean VC-static
MinGW32 (creates libpthreadGCn.a as a static link lib):
make clean GC-static
Define PTW32_STATIC_LIB also when building your application.
Building the library under Cygwin
---------------------------------
Cygwin implements it's own POSIX threads routines and these
will be the ones to use if you develop using Cygwin.
Building applications
---------------------
The files you will need for your application build are:
The four header files:
_ptw32.h
pthread.h
semaphore.h
sched.h
The DLL library files that you built:
pthread*.dll
plus the matching *.lib (MSVS) or *.a file (GNU)
or, the static link library that you built:
pthread*.lib (MSVS) or libpthread*.a (GNU)
Place them in the appropriate directories for your build, which may be the
standard compiler locations or, locations specific to your project (you
might have a separate third-party dependency tree for example).
Acknowledgements
----------------
See the ANNOUNCE file for acknowledgements.
See the 'CONTRIBUTORS' file for the list of contributors.
As much as possible, the ChangeLog file attributes
contributions and patches that have been incorporated
in the library to the individuals responsible.
Finally, thanks to all those who work on and contribute to the
POSIX and Single Unix Specification standards. The maturity of an
industry can be measured by it's open standards.
----
Ross Johnson
<ross.johnson@loungebythelake.net>

View File

@ -0,0 +1,218 @@
/*
* Module: _ptw32.h
*
* Purpose:
* Pthreads4w internal macros, to be shared by other headers
* comprising the Pthreads4w package.
*
* --------------------------------------------------------------------------
*
* Pthreads4w - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999-2018, Pthreads4w contributors
*
* Homepage: https://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* https://sourceforge.net/p/pthreads4w/wiki/Contributors/
*
* This file is part of Pthreads4w.
*
* Pthreads4w is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pthreads4w is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pthreads4w. If not, see <http://www.gnu.org/licenses/>. *
*/
#ifndef __PTW32_H
#define __PTW32_H
/* See the README file for an explanation of the Pthreads4w
* version numbering scheme and how the DLL is named etc.
*
* FIXME: consider moving this to <_ptw32.h>; maybe also add a
* leading underscore to the macro names.
*/
#define PTW32_VERSION_MAJOR 2
#define PTW32_VERSION_MINOR 11
#define PTW32_VERSION_MICRO 0
#define PTW32_VERION_BUILD 0
#define PTW32_VERSION 2,11,0,0
#define PTW32_VERSION_STRING "2, 11, 0, 0\0"
#if defined(__GNUC__) && !defined(__INTEL_LLVM_COMPILER)
# pragma GCC system_header
# if ! defined __declspec
# error "Please upgrade your GNU compiler to one that supports __declspec."
# endif
#endif
#if defined (__cplusplus)
# define __PTW32_BEGIN_C_DECLS extern "C" {
# define __PTW32_END_C_DECLS }
#else
# define __PTW32_BEGIN_C_DECLS
# define __PTW32_END_C_DECLS
#endif
#if defined PTW32_STATIC_LIB
# define PTW32_DLLPORT
#elif defined PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
#else
# define PTW32_DLLPORT /*__declspec (dllimport)*/
#endif
#ifndef PTW32_CDECL
/* FIXME: another internal macro; should have two initial underscores;
* Nominally, we prefer to use __cdecl calling convention for all our
* functions, but we map it through this macro alias to facilitate the
* possible choice of alternatives; for example:
*/
# ifdef _OPEN_WATCOM_SOURCE
/* The Open Watcom C/C++ compiler uses a non-standard default calling
* convention, (similar to __fastcall), which passes function arguments
* in registers, unless the __cdecl convention is explicitly specified
* in exposed function prototypes.
*
* Our preference is to specify the __cdecl convention for all calls,
* even though this could slow Watcom code down slightly. If you know
* that the Watcom compiler will be used to build both the DLL and your
* application, then you may #define _OPEN_WATCOM_SOURCE, so disabling
* the forced specification of __cdecl for all function declarations;
* remember that this must be defined consistently, for both the DLL
* build, and the application build.
*/
# define PTW32_CDECL
# else
# define PTW32_CDECL __cdecl
# endif
#endif
/*
* This is more or less a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries. They
*/
#if !defined(PTW32_CONFIG_H) && !defined(__PTW32_PSEUDO_CONFIG_H_SOURCED)
# define __PTW32_PSEUDO_CONFIG_H_SOURCED
# if defined(WINCE)
# undef HAVE_CPU_AFFINITY
# define NEED_DUPLICATEHANDLE
# define NEED_CREATETHREAD
# define NEED_ERRNO
# define NEED_CALLOC
# define NEED_UNICODE_CONSTS
# define NEED_PROCESS_AFFINITY_MASK
/* This may not be needed */
# define RETAIN_WSALASTERROR
# elif defined(_MSC_VER)
# if _MSC_VER >= 1900
# define HAVE_STRUCT_TIMESPEC
# elif _MSC_VER < 1300
# define PTW32_CONFIG_MSVC6
# elif _MSC_VER < 1400
# define PTW32_CONFIG_MSVC7
# endif
# elif defined(_UWIN)
# define HAVE_MODE_T
# define HAVE_STRUCT_TIMESPEC
# define HAVE_SIGNAL_H
# endif
#endif
/*
* If HAVE_ERRNO_H is defined then assume that autoconf has been used
* to overwrite config.h, otherwise the original config.h is in use
* at build-time or the above block of defines is in use otherwise
* and NEED_ERRNO is either defined or not defined.
*/
#if defined(HAVE_ERRNO_H) || !defined(NEED_ERRNO)
# include <errno.h>
#else
# include "need_errno.h"
#endif
#if defined(__BORLANDC__)
# define int64_t LONGLONG
# define uint64_t ULONGLONG
#elif !defined(__MINGW32__)
typedef _int64 int64_t;
typedef unsigned _int64 uint64_t;
# if defined(PTW32_CONFIG_MSVC6)
typedef long intptr_t;
# endif
#elif defined(HAVE_STDINT_H) && HAVE_STDINT_H == 1
# include <stdint.h>
#endif
/*
* In case ETIMEDOUT hasn't been defined above somehow.
*/
#if !defined(ETIMEDOUT)
/*
* note: ETIMEDOUT is no longer defined in winsock.h
* WSAETIMEDOUT is so use its value.
*/
# include <winsock.h>
# if defined(WSAETIMEDOUT)
# define ETIMEDOUT WSAETIMEDOUT
# else
# define ETIMEDOUT 10060 /* This is the value of WSAETIMEDOUT in winsock.h. */
# endif
#endif
/*
* Several systems may not define some error numbers;
* defining those which are likely to be missing here will let
* us complete the library builds.
*/
#if !defined(ENOTSUP)
# define ENOTSUP 48 /* This is the value in Solaris. */
#endif
#if !defined(ENOSYS)
# define ENOSYS 140 /* Semi-arbitrary value */
#endif
#if !defined(EDEADLK)
# if defined(EDEADLOCK)
# define EDEADLK EDEADLOCK
# else
# define EDEADLK 36 /* This is the value in MSVC. */
# endif
#endif
/* POSIX 2008 - related to robust mutexes */
/*
* FIXME: These should be changed for version 3.0.0 onward.
* 42 clashes with EILSEQ.
*/
#if PTW32_VERSION_MAJOR > 2
# if !defined(EOWNERDEAD)
# define EOWNERDEAD 1000
# endif
# if !defined(ENOTRECOVERABLE)
# define ENOTRECOVERABLE 1001
# endif
#else
# if !defined(EOWNERDEAD)
# define EOWNERDEAD 42
# endif
# if !defined(ENOTRECOVERABLE)
# define ENOTRECOVERABLE 43
# endif
#endif
#endif /* !__PTW32_H */

View File

@ -1,45 +1,38 @@
/* This is an implementation of the threads API of POSIX 1003.1-2001.
/* This is an implementation of the threads API of the Single Unix Specification.
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Pthreads4w - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* Copyright(C) 1999-2018, Pthreads4w contributors
*
* Homepage: https://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
* https://sourceforge.net/p/pthreads4w/wiki/Contributors/
*
* This file is part of Pthreads4w.
*
* Pthreads4w is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pthreads4w is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pthreads4w. If not, see <http://www.gnu.org/licenses/>. *
*/
#if !defined( PTHREAD_H )
#define PTHREAD_H
/*
* See the README file for an explanation of the pthreads-win32 version
* numbering scheme and how the DLL is named etc.
*/
#define PTW32_VERSION 2,9,1,0
#define PTW32_VERSION_STRING "2, 9, 1, 0\0"
/* There are three implementations of cancel cleanup.
* Note that pthread.h is included in both application
* compilation units and also internally for the library.
@ -65,7 +58,7 @@
* Define defaults for cleanup code.
* Note: Unless the build explicitly defines one of the following, then
* we default to standard C style cleanup. This style uses setjmp/longjmp
* in the cancelation and thread exit implementations and therefore won't
* in the cancellation and thread exit implementations and therefore won't
* do stack unwinding if linked to applications that have it (e.g.
* C++ apps). This is currently consistent with most/all commercial Unix
* POSIX threads implementations.
@ -78,42 +71,31 @@
#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
#endif
#include <_ptw32.h>
/*
* Stop here if we are being included by the resource compiler.
*/
#if !defined(RC_INVOKED)
#undef PTW32_LEVEL
#undef __PTW32_LEVEL
#undef __PTW32_LEVEL_MAX
#define __PTW32_LEVEL_MAX 3
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0
/* Early POSIX */
#endif
#if _POSIX_C_SOURCE >= 200112L /* POSIX.1-2001 and later */
# define __PTW32_LEVEL __PTW32_LEVEL_MAX /* include everything */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#elif defined INCLUDE_NP /* earlier than POSIX.1-2001, but... */
# define __PTW32_LEVEL 2 /* include non-portable extensions */
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#elif _POSIX_C_SOURCE >= 199309L /* POSIX.1-1993 */
# define __PTW32_LEVEL 1 /* include 1b, 1c, and 1d */
#define PTW32_LEVEL_MAX 3
#elif defined _POSIX_SOURCE /* early POSIX */
# define __PTW32_LEVEL 0 /* minimal support */
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
#if defined(_UWIN)
# define HAVE_STRUCT_TIMESPEC 1
# define HAVE_SIGNAL_H 1
# undef HAVE_PTW32_CONFIG_H
# pragma comment(lib, "pthread")
#else /* unspecified support level */
# define __PTW32_LEVEL __PTW32_LEVEL_MAX /* include everything anyway */
#endif
/*
@ -184,170 +166,19 @@
* The source code and other information about this library
* are available from
*
* http://sources.redhat.com/pthreads-win32/
* https://sourceforge.net/projects/pthreads4w//
*
* -------------------------------------------------------------
*/
/* Try to avoid including windows.h */
#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus)
#define PTW32_INCLUDE_WINDOWS_H
#endif
#if defined(PTW32_INCLUDE_WINDOWS_H)
#include <windows.h>
#endif
#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__)
/*
* VC++6.0 or early compiler's header has no DWORD_PTR type.
*/
typedef unsigned long DWORD_PTR;
typedef unsigned long ULONG_PTR;
#endif
/*
* -----------------
* autoconf switches
* -----------------
*/
#if defined(HAVE_PTW32_CONFIG_H)
#include "config.h"
#endif /* HAVE_PTW32_CONFIG_H */
#if !defined(NEED_FTIME)
#include <time.h>
#else /* NEED_FTIME */
/* use native WIN32 time API */
#endif /* NEED_FTIME */
#if defined(HAVE_SIGNAL_H)
#include <signal.h>
#endif /* HAVE_SIGNAL_H */
#include <limits.h>
/*
* Boolean values to make us independent of system includes.
*/
enum {
enum
{ /* Boolean values to make us independent of system includes. */
PTW32_FALSE = 0,
PTW32_TRUE = (! PTW32_FALSE)
};
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#if !defined(PTW32_CONFIG_H)
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(__MINGW64__)
# define HAVE_STRUCT_TIMESPEC
# define HAVE_MODE_T
# elif defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#if defined(NEED_ERRNO)
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
/*
* Several systems don't define some error numbers.
*/
#if !defined(ENOTSUP)
# define ENOTSUP 48 /* This is the value in Solaris. */
#endif
#if !defined(ETIMEDOUT)
# define ETIMEDOUT 10060 /* Same as WSAETIMEDOUT */
#endif
#if !defined(ENOSYS)
# define ENOSYS 140 /* Semi-arbitrary value */
#endif
#if !defined(EDEADLK)
# if defined(EDEADLOCK)
# define EDEADLK EDEADLOCK
# else
# define EDEADLK 36 /* This is the value in MSVC. */
# endif
#endif
/* POSIX 2008 - related to robust mutexes */
#if !defined(EOWNERDEAD)
# define EOWNERDEAD 43
#endif
#if !defined(ENOTRECOVERABLE)
# define ENOTRECOVERABLE 44
#endif
#include <time.h>
#include <sched.h>
/*
* To avoid including windows.h we define only those things that we
* actually need from it.
*/
#if !defined(PTW32_INCLUDE_WINDOWS_H)
#if !defined(HANDLE)
# define PTW32__HANDLE_DEF
# define HANDLE void *
#endif
#if !defined(DWORD)
# define PTW32__DWORD_DEF
# define DWORD unsigned long
#endif
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1900
# define HAVE_STRUCT_TIMESPEC
# ifndef _TIMESPEC_DEFINED
# define _TIMESPEC_DEFINED
# endif
#endif
#if !defined(HAVE_STRUCT_TIMESPEC)
#define HAVE_STRUCT_TIMESPEC
#if !defined(_TIMESPEC_DEFINED)
#define _TIMESPEC_DEFINED
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */
#if !defined(SIG_BLOCK)
#define SIG_BLOCK 0
#endif /* SIG_BLOCK */
#if !defined(SIG_UNBLOCK)
#define SIG_UNBLOCK 1
#endif /* SIG_UNBLOCK */
#if !defined(SIG_SETMASK)
#define SIG_SETMASK 2
#endif /* SIG_SETMASK */
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
/*
* -------------------------------------------------------------
*
@ -355,27 +186,27 @@ extern "C"
* =========================
*
* Options are normally set in <unistd.h>, which is not provided
* with pthreads-win32.
* with Pthreads4w.
*
* For conformance with the Single Unix Specification (version 3), all of the
* options below are defined, and have a value of either -1 (not supported)
* or 200112L (supported).
* or yyyymm[dd]L (supported).
*
* These options can neither be left undefined nor have a value of 0, because
* either indicates that sysconf(), which is not implemented, may be used at
* runtime to check the status of the option.
*
* _POSIX_THREADS (== 200112L)
* If == 200112L, you can use threads
* _POSIX_THREADS (== 20080912L)
* If == 20080912L, you can use threads
*
* _POSIX_THREAD_ATTR_STACKSIZE (== 200112L)
* If == 200112L, you can control the size of a thread's
* _POSIX_THREAD_ATTR_STACKSIZE (== 200809L)
* If == 200809L, you can control the size of a thread's
* stack
* pthread_attr_getstacksize
* pthread_attr_setstacksize
*
* _POSIX_THREAD_ATTR_STACKADDR (== -1)
* If == 200112L, you can allocate and control a thread's
* If == 200809L, you can allocate and control a thread's
* stack. If not supported, the following functions
* will return ENOSYS, indicating they are not
* supported:
@ -390,13 +221,13 @@ extern "C"
* writers over readers when threads have equal priority.
*
* _POSIX_THREAD_PRIO_INHERIT (== -1)
* If == 200112L, you can create priority inheritance
* If == 200809L, you can create priority inheritance
* mutexes.
* pthread_mutexattr_getprotocol +
* pthread_mutexattr_setprotocol +
*
* _POSIX_THREAD_PRIO_PROTECT (== -1)
* If == 200112L, you can create priority ceiling mutexes
* If == 200809L, you can create priority ceiling mutexes
* Indicates the availability of:
* pthread_mutex_getprioceiling
* pthread_mutex_setprioceiling
@ -415,22 +246,24 @@ extern "C"
* pthread_condattr_getpshared
* pthread_condattr_setpshared
*
* _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L)
* If == 200112L you can use the special *_r library
* _POSIX_THREAD_SAFE_FUNCTIONS (== 200809L)
* If == 200809L you can use the special *_r library
* functions that provide thread-safe behaviour
*
* _POSIX_READER_WRITER_LOCKS (== 200112L)
* If == 200112L, you can use read/write locks
* _POSIX_READER_WRITER_LOCKS (== 200809L)
* If == 200809L, you can use read/write locks
*
* _POSIX_SPIN_LOCKS (== 200112L)
* If == 200112L, you can use spin locks
* _POSIX_SPIN_LOCKS (== 200809L)
* If == 200809L, you can use spin locks
*
* _POSIX_BARRIERS (== 200112L)
* If == 200112L, you can use barriers
* _POSIX_BARRIERS (== 200809L)
* If == 200809L, you can use barriers
*
* + These functions provide both 'inherit' and/or
* 'protect' protocol, based upon these macro
* settings.
* _POSIX_ROBUST_MUTEXES (== 200809L)
* If == 200809L, you can use robust mutexes
* Officially this should also imply
* _POSIX_THREAD_PROCESS_SHARED != -1 however
* not here yet.
*
* -------------------------------------------------------------
*/
@ -438,42 +271,45 @@ extern "C"
/*
* POSIX Options
*/
#undef _POSIX_THREADS
#define _POSIX_THREADS 200809L
#undef _POSIX_THREADS
#define _POSIX_THREADS 200809L
#undef _POSIX_READER_WRITER_LOCKS
#define _POSIX_READER_WRITER_LOCKS 200809L
#undef _POSIX_READER_WRITER_LOCKS
#define _POSIX_READER_WRITER_LOCKS 200809L
#undef _POSIX_SPIN_LOCKS
#define _POSIX_SPIN_LOCKS 200809L
#undef _POSIX_SPIN_LOCKS
#define _POSIX_SPIN_LOCKS 200809L
#undef _POSIX_BARRIERS
#define _POSIX_BARRIERS 200809L
#undef _POSIX_BARRIERS
#define _POSIX_BARRIERS 200809L
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
#undef _POSIX_THREAD_ATTR_STACKSIZE
#define _POSIX_THREAD_ATTR_STACKSIZE 200809L
#undef _POSIX_THREAD_ATTR_STACKSIZE
#define _POSIX_THREAD_ATTR_STACKSIZE 200809L
#undef _POSIX_ROBUST_MUTEXES
#define _POSIX_ROBUST_MUTEXES 200809L
/*
* The following options are not supported
*/
#undef _POSIX_THREAD_ATTR_STACKADDR
#define _POSIX_THREAD_ATTR_STACKADDR -1
#undef _POSIX_THREAD_ATTR_STACKADDR
#define _POSIX_THREAD_ATTR_STACKADDR -1
#undef _POSIX_THREAD_PRIO_INHERIT
#define _POSIX_THREAD_PRIO_INHERIT -1
#undef _POSIX_THREAD_PRIO_INHERIT
#define _POSIX_THREAD_PRIO_INHERIT -1
#undef _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PRIO_PROTECT -1
#undef _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PRIO_PROTECT -1
/* TPS is not fully supported. */
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
#undef _POSIX_THREAD_PROCESS_SHARED
#define _POSIX_THREAD_PROCESS_SHARED -1
#undef _POSIX_THREAD_PROCESS_SHARED
#define _POSIX_THREAD_PROCESS_SHARED -1
/*
@ -481,7 +317,7 @@ extern "C"
* ===========================
*
* These limits are normally set in <limits.h>, which is not provided with
* pthreads-win32.
* Pthreads4w.
*
* PTHREAD_DESTRUCTOR_ITERATIONS
* Maximum number of attempts to destroy
@ -508,85 +344,64 @@ extern "C"
* (must be at least 32767)
*
*/
#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#undef PTHREAD_DESTRUCTOR_ITERATIONS
#undef PTHREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#undef _POSIX_THREAD_KEYS_MAX
#undef _POSIX_THREAD_KEYS_MAX
#define _POSIX_THREAD_KEYS_MAX 128
#undef PTHREAD_KEYS_MAX
#undef PTHREAD_KEYS_MAX
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
#undef PTHREAD_STACK_MIN
#undef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 0
#undef _POSIX_THREAD_THREADS_MAX
#undef _POSIX_THREAD_THREADS_MAX
#define _POSIX_THREAD_THREADS_MAX 64
/* Arbitrary value */
#undef PTHREAD_THREADS_MAX
/* Arbitrary value */
#undef PTHREAD_THREADS_MAX
#define PTHREAD_THREADS_MAX 2019
#undef _POSIX_SEM_NSEMS_MAX
#undef _POSIX_SEM_NSEMS_MAX
#define _POSIX_SEM_NSEMS_MAX 256
/* Arbitrary value */
#undef SEM_NSEMS_MAX
/* Arbitrary value */
#undef SEM_NSEMS_MAX
#define SEM_NSEMS_MAX 1024
#undef _POSIX_SEM_VALUE_MAX
#undef _POSIX_SEM_VALUE_MAX
#define _POSIX_SEM_VALUE_MAX 32767
#undef SEM_VALUE_MAX
#undef SEM_VALUE_MAX
#define SEM_VALUE_MAX INT_MAX
#if defined(__GNUC__) && !defined(__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the library, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the library,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#if !defined(PTW32_STATIC_LIB)
# if defined(PTW32_BUILD)
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* The Open Watcom C/C++ compiler uses a non-standard calling convention
* that passes function args in registers unless __cdecl is explicitly specified
* in exposed function prototypes.
*
* We force all calls to cdecl even though this could slow Watcom code down
* slightly. If you know that the Watcom compiler will be used to build both
* the DLL and application, then you can probably define this as a null string.
* Remember that pthread.h (this file) is used for both the DLL and application builds.
*/
#define PTW32_CDECL __cdecl
#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
#if defined(_UWIN) && __PTW32_LEVEL >= __PTW32_LEVEL_MAX
# include <sys/types.h>
#else
/*
* Generic handle type - intended to extend uniqueness beyond
* that available with a simple pointer. It should scale for either
* IA-32 or IA-64.
/* Generic handle type - intended to provide the lifetime-uniqueness that
* a simple pointer can't. It should scale for either
* 32 or 64 bit systems.
*
* The constraint with this approach is that applications must
* strictly comply with POSIX, e.g. not assume scalar type, only
* compare pthread_t using the API function pthread_equal(), etc.
*
* Applications can use the element 'p' to compare, e.g. for sorting,
* but it will be up to the application to determine if handles are
* live or dead, or resurrected for an entirely new/different thread.
*/
typedef struct {
void * p; /* Pointer to actual object */
unsigned int x; /* Extra information - reuse count etc */
typedef struct
{ void * p; /* Pointer to actual object */
#if PTW32_VERSION_MAJOR > 2
size_t x; /* Extra information - reuse count etc */
#else
unsigned int x; /* Extra information - reuse count etc */
#endif
} ptw32_handle_t;
typedef ptw32_handle_t pthread_t;
@ -598,6 +413,7 @@ typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
typedef struct pthread_cond_t_ * pthread_cond_t;
typedef struct pthread_condattr_t_ * pthread_condattr_t;
#endif
typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
@ -612,60 +428,52 @@ typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
* ====================
*/
enum {
/*
* pthread_attr_{get,set}detachstate
*/
enum
{ /* pthread_attr_{get,set}detachstate
*/
PTHREAD_CREATE_JOINABLE = 0, /* Default */
PTHREAD_CREATE_DETACHED = 1,
/*
* pthread_attr_{get,set}inheritsched
*/
/*
* pthread_attr_{get,set}inheritsched
*/
PTHREAD_INHERIT_SCHED = 0,
PTHREAD_EXPLICIT_SCHED = 1, /* Default */
/*
* pthread_{get,set}scope
*/
/*
* pthread_{get,set}scope
*/
PTHREAD_SCOPE_PROCESS = 0,
PTHREAD_SCOPE_SYSTEM = 1, /* Default */
/*
* pthread_setcancelstate paramters
*/
/*
* pthread_setcancelstate paramters
*/
PTHREAD_CANCEL_ENABLE = 0, /* Default */
PTHREAD_CANCEL_DISABLE = 1,
/*
* pthread_setcanceltype parameters
*/
/*
* pthread_setcanceltype parameters
*/
PTHREAD_CANCEL_ASYNCHRONOUS = 0,
PTHREAD_CANCEL_DEFERRED = 1, /* Default */
/*
* pthread_mutexattr_{get,set}pshared
* pthread_condattr_{get,set}pshared
*/
/*
* pthread_mutexattr_{get,set}pshared
* pthread_condattr_{get,set}pshared
*/
PTHREAD_PROCESS_PRIVATE = 0,
PTHREAD_PROCESS_SHARED = 1,
/*
* pthread_mutexattr_{get,set}robust
*/
/*
* pthread_mutexattr_{get,set}robust
*/
PTHREAD_MUTEX_STALLED = 0, /* Default */
PTHREAD_MUTEX_ROBUST = 1,
/*
* pthread_barrier_wait
*/
/*
* pthread_barrier_wait
*/
PTHREAD_BARRIER_SERIAL_THREAD = -1
};
/*
* ====================
* ====================
* Cancelation
* cancellation
* ====================
* ====================
*/
@ -679,16 +487,30 @@ enum {
* ====================
* ====================
*/
#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0}
#if PTW32_VERSION_MAJOR > 2
#define PTHREAD_ONCE_INIT { 0, PTW32_FALSE }
struct pthread_once_t_
{
int done; /* indicates if user function has been executed */
void * lock;
void * lock; /* MCS lock */
int done; /* indicates if user function has been executed */
};
#else
#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0 }
struct pthread_once_t_
{
int done; /* indicates if user function has been executed */
void * lock; /* MCS lock */
int reserved1;
int reserved2;
};
#endif
/*
* ====================
@ -884,6 +706,7 @@ struct ptw32_cleanup_t
#endif /* __CLEANUP_SEH */
/*
* ===============
* ===============
@ -892,6 +715,8 @@ struct ptw32_cleanup_t
* ===============
*/
__PTW32_BEGIN_C_DECLS
/*
* PThread Attribute Functions
*/
@ -899,6 +724,10 @@ PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getaffinity_np (const pthread_attr_t * attr,
size_t cpusetsize,
cpu_set_t * cpuset);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
int *detachstate);
@ -908,6 +737,10 @@ PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t *
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
size_t * stacksize);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setaffinity_np (pthread_attr_t * attr,
size_t cpusetsize,
const cpu_set_t * cpuset);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
int detachstate);
@ -974,13 +807,13 @@ PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
void (PTW32_CDECL *init_routine) (void));
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
ptw32_cleanup_callback_t routine,
void *arg);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#endif /* __PTW32_LEVEL >= __PTW32_LEVEL_MAX */
/*
* Thread Specific Data Functions
@ -1121,7 +954,7 @@ PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
struct sched_param *param);
PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
/*
@ -1158,7 +991,7 @@ PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwloc
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
int pshared);
#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX - 1
/*
* Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
@ -1177,6 +1010,17 @@ PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t *
int kind);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
int *kind);
PTW32_DLLPORT int PTW32_CDECL pthread_timedjoin_np(pthread_t thread,
void **value_ptr,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_tryjoin_np(pthread_t thread,
void **value_ptr);
PTW32_DLLPORT int PTW32_CDECL pthread_setaffinity_np(pthread_t thread,
size_t cpusetsize,
const cpu_set_t *cpuset);
PTW32_DLLPORT int PTW32_CDECL pthread_getaffinity_np(pthread_t thread,
size_t cpusetsize,
cpu_set_t *cpuset);
/*
* Possibly supported by other POSIX threads implementations
@ -1194,13 +1038,23 @@ PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void);
PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void);
PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void);
/*
* Returns the first parameter "abstime" modified to represent the current system time.
* If "relative" is not NULL it represents an interval to add to "abstime".
*/
PTW32_DLLPORT struct timespec * PTW32_CDECL pthread_win32_getabstime_np(
struct timespec * abstime,
const struct timespec * relative);
/*
* Features that are auto-detected at load/run time.
*/
PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int);
enum ptw32_features {
PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */
enum ptw32_features
{
PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */
};
/*
@ -1213,25 +1067,41 @@ enum ptw32_features {
*/
PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
#endif /* __PTW32_LEVEL >= __PTW32_LEVEL_MAX - 1 */
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
/*
* Returns the Win32 HANDLE for the POSIX thread.
*/
PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
PTW32_DLLPORT void * PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
/*
* Returns the win32 thread ID for POSIX thread.
*/
PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
PTW32_DLLPORT unsigned long PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
/*
* Sets the POSIX thread name. If _MSC_VER is defined the name should be displayed by
* the MSVS debugger.
*/
#if defined(PTW32_COMPATIBILITY_BSD) || defined(PTW32_COMPATIBILITY_TRU64)
#define PTHREAD_MAX_NAMELEN_NP 16
PTW32_DLLPORT int PTW32_CDECL pthread_setname_np (pthread_t thr, const char * name, void * arg);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setname_np (pthread_attr_t * attr, const char * name, void * arg);
#else
PTW32_DLLPORT int PTW32_CDECL pthread_setname_np (pthread_t thr, const char * name);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setname_np (pthread_attr_t * attr, const char * name);
#endif
PTW32_DLLPORT int PTW32_CDECL pthread_getname_np (pthread_t thr, char * name, int len);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getname_np (pthread_attr_t * attr, char * name, int len);
/*
* Protected Methods
*
* This function blocks until the given WIN32 handle
* is signaled or pthread_cancel had been called.
* is signalled or pthread_cancel had been called.
* This function allows the caller to hook into the
* PThreads cancel mechanism. It is implemented using
*
@ -1242,34 +1112,26 @@ PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
* argument to TimedWait is simply passed to
* WaitForMultipleObjects.
*/
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
DWORD timeout);
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (void *waitHandle);
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (void *waitHandle,
unsigned long timeout);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#endif /* __PTW32_LEVEL >= __PTW32_LEVEL_MAX */
/*
* Thread-Safe C Runtime Library Mappings.
* Declare a thread-safe errno for Open Watcom
* (note: this has not been tested in a long time)
*/
#if !defined(_UWIN)
# if defined(NEED_ERRNO)
PTW32_DLLPORT int * PTW32_CDECL _errno( void );
# else
# if !defined(errno)
# if (defined(_MT) || defined(_DLL))
__declspec(dllimport) extern int * __cdecl _errno(void);
# define errno (*_errno())
# endif
# endif
#if defined(__WATCOMC__) && !defined(errno)
# if defined(_MT) || defined(_DLL)
__declspec(dllimport) extern int * __cdecl _errno(void);
# define errno (*_errno())
# endif
#endif
/*
* Some compiler environments don't define some things.
*/
#if defined(__BORLANDC__)
# define _ftime ftime
# define _timeb timeb
#if defined(PTW32_USES_SEPARATE_CRT) && (defined(__CLEANUP_CXX) || defined(__CLEANUP_SEH))
typedef void (*ptw32_terminate_handler)();
PTW32_DLLPORT ptw32_terminate_handler PTW32_CDECL pthread_win32_set_terminate_np(ptw32_terminate_handler termFunction);
#endif
#if defined(__cplusplus)
@ -1283,15 +1145,15 @@ class ptw32_exception_exit : public ptw32_exception {};
#endif
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
/* FIXME: This is only required if the library was built using SEH */
/*
* Get internal SEH tag
*/
PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
PTW32_DLLPORT unsigned long PTW32_CDECL ptw32_get_exception_services_code(void);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#endif /* __PTW32_LEVEL >= __PTW32_LEVEL_MAX */
#if !defined(PTW32_BUILD)
@ -1316,7 +1178,7 @@ PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
#if defined(_MSC_VER)
/*
* WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
* if you want Pthread-Win32 cancelation and pthread_exit to work.
* if you want Pthread-Win32 cancellation and pthread_exit to work.
*/
#if !defined(PtW32NoCatchWarn)
@ -1326,7 +1188,7 @@ PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads")
#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
#pragma message(" cancelation and pthread_exit to work. For example:")
#pragma message(" cancellation and pthread_exit to work. For example:")
#pragma message("")
#pragma message(" #if defined(PtW32CatchAll)")
#pragma message(" PtW32CatchAll")
@ -1356,19 +1218,10 @@ PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
#endif /* ! PTW32_BUILD */
#if defined(__cplusplus)
} /* End of extern "C" */
#endif /* __cplusplus */
__PTW32_END_C_DECLS
#if defined(PTW32__HANDLE_DEF)
# undef HANDLE
#endif
#if defined(PTW32__DWORD_DEF)
# undef DWORD
#endif
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#undef __PTW32_LEVEL
#undef __PTW32_LEVEL_MAX
#endif /* ! RC_INVOKED */

View File

@ -0,0 +1,237 @@
/*
* Module: sched.h
*
* Purpose:
* Provides an implementation of POSIX realtime extensions
* as defined in
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads4w - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999-2018, Pthreads4w contributors
*
* Homepage: https://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* https://sourceforge.net/p/pthreads4w/wiki/Contributors/
*
* This file is part of Pthreads4w.
*
* Pthreads4w is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pthreads4w is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pthreads4w. If not, see <http://www.gnu.org/licenses/>. *
*/
#if !defined(_SCHED_H)
#define _SCHED_H
#define __SCHED_H_SOURCED__
#include <_ptw32.h>
/* We need a typedef for pid_t, (and POSIX requires <sched.h> to
* define it, as it is defined in <sys/types.h>, but it does NOT
* sanction exposure of everything from <sys/types.h>); there is
* no pid_t in Windows anyway, (except that MinGW does define it
* in their <sys/types.h>), so just provide a suitable typedef,
* but note that we must do so cautiously, to avoid a typedef
* conflict if MinGW's <sys/types.h> is also #included:
*/
#if ! defined __MINGW32__ || ! defined __have_typedef_pid_t
# if defined __MINGW64__
typedef __int64 pid_t;
# else
typedef int pid_t;
#endif
#if __GNUC__ < 4
/* GCC v4.0 and later, (as used by MinGW), allows us to repeat a
* typedef, provided every duplicate is consistent; only set this
* multiple definition guard when we cannot be certain that it is
* permissable to repeat typedefs.
*/
#define __have_typedef_pid_t 1
#endif
#endif
/* POSIX.1-1993 says that <sched.h> WILL expose all of <time.h>
*/
#undef __SCHED_H_SOURCED__
#if _POSIX_C_SOURCE >= 200112L
/* POSIX.1-2001 and later revises this to say only that it MAY do so;
* only struct timespec, and associated time_t are actually required,
* so prefer to be selective; (MinGW.org's <time.h> offers an option
* for selective #inclusion, when __SCHED_H_SOURCED__ is defined):
*/
#define __SCHED_H_SOURCED__
#define __need_struct_timespec
#define __need_time_t
#endif
#include <time.h>
#if defined __MINGW64__ || _MSC_VER >= 1900
/* These are known to define struct timespec, when <time.h> has been
* #included, but may not, (probably don't), follow the convention of
* defining __struct_timespec_defined, as adopted by MinGW.org; for
* these cases, we unconditionally assume that struct timespec has
* been defined, otherwise, if MinGW.org's criterion has not been
* satisfied...
*/
#elif ! defined __struct_timespec_defined
# ifndef _TIMESPEC_DEFINED
# define _TIMESPEC_DEFINED
struct timespec
{ /* ...we fall back on this explicit definition.
*/
time_t tv_sec;
int tv_nsec;
};
# endif
#endif
/*
* Microsoft VC++6.0 lacks these *_PTR types
*/
#if defined(_MSC_VER) && _MSC_VER < 1300 && !defined(PTW32_HAVE_DWORD_PTR)
typedef unsigned long ULONG_PTR;
typedef ULONG_PTR DWORD_PTR;
#endif
/* Thread scheduling policies */
enum
{ SCHED_OTHER = 0,
SCHED_FIFO,
SCHED_RR,
SCHED_MIN = SCHED_OTHER,
SCHED_MAX = SCHED_RR
};
struct sched_param
{ int sched_priority;
};
/*
* CPU affinity
*
* cpu_set_t:
* Considered opaque but cannot be an opaque pointer due to the need for
* compatibility with GNU systems and sched_setaffinity() et.al., which
* include the cpusetsize parameter "normally set to sizeof(cpu_set_t)".
*
* FIXME: These are GNU, and NOT specified by POSIX; maybe consider
* occluding them within a _GNU_SOURCE (or similar) feature test.
*/
#define CPU_SETSIZE (sizeof(size_t)*8)
#define CPU_COUNT(setptr) (_sched_affinitycpucount(setptr))
#define CPU_ZERO(setptr) (_sched_affinitycpuzero(setptr))
#define CPU_SET(cpu, setptr) (_sched_affinitycpuset((cpu),(setptr)))
#define CPU_CLR(cpu, setptr) (_sched_affinitycpuclr((cpu),(setptr)))
#define CPU_ISSET(cpu, setptr) (_sched_affinitycpuisset((cpu),(setptr)))
#define CPU_AND(destsetptr, srcset1ptr, srcset2ptr) (_sched_affinitycpuand((destsetptr),(srcset1ptr),(srcset2ptr)))
#define CPU_OR(destsetptr, srcset1ptr, srcset2ptr) (_sched_affinitycpuor((destsetptr),(srcset1ptr),(srcset2ptr)))
#define CPU_XOR(destsetptr, srcset1ptr, srcset2ptr) \
(_sched_affinitycpuxor((destsetptr),(srcset1ptr),(srcset2ptr)))
#define CPU_EQUAL(set1ptr, set2ptr) (_sched_affinitycpuequal((set1ptr),(set2ptr)))
typedef union
{ char cpuset[CPU_SETSIZE/8];
size_t _align;
} cpu_set_t;
__PTW32_BEGIN_C_DECLS
PTW32_DLLPORT int PTW32_CDECL sched_yield (void);
PTW32_DLLPORT int PTW32_CDECL sched_get_priority_min (int policy);
PTW32_DLLPORT int PTW32_CDECL sched_get_priority_max (int policy);
/* FIXME: this declaration of sched_setscheduler() is NOT as prescribed
* by POSIX; it lacks const struct sched_param * as third argument.
*/
PTW32_DLLPORT int PTW32_CDECL sched_setscheduler (pid_t pid, int policy);
/* FIXME: In addition to the above five functions, POSIX also requires:
*
* int sched_getparam (pid_t, struct sched_param *);
* int sched_setparam (pid_t, const struct sched_param *);
*
* both of which are conspicuous by their absence here!
*/
/* Compatibility with Linux - not standard in POSIX
* FIXME: consider occluding within a _GNU_SOURCE (or similar) feature test.
*/
PTW32_DLLPORT int PTW32_CDECL sched_setaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask);
PTW32_DLLPORT int PTW32_CDECL sched_getaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask);
/*
* Support routines and macros for cpu_set_t
*/
PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpucount (const cpu_set_t *set);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuzero (cpu_set_t *pset);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuset (int cpu, cpu_set_t *pset);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuclr (int cpu, cpu_set_t *pset);
PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpuisset (int cpu, const cpu_set_t *pset);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuand(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuor(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2);
PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuxor(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2);
PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpuequal (const cpu_set_t *pset1, const cpu_set_t *pset2);
/* Note that this macro returns ENOTSUP rather than ENOSYS, as
* might be expected. However, returning ENOSYS should mean that
* sched_get_priority_{min,max} are not implemented as well as
* sched_rr_get_interval. This is not the case, since we just
* don't support round-robin scheduling. Therefore I have chosen
* to return the same value as sched_setscheduler when SCHED_RR
* is passed to it.
*
* FIXME: POSIX requires this to be defined as a function; this
* macro implementation is permitted IN ADDITION to the function,
* but the macro alone is not POSIX compliant! Worse still, it
* imposes a requirement on the caller, to ensure that both the
* declaration of errno, and the definition of ENOTSUP, are in
* scope at point of call, (which it may wish to do anyway, but
* POSIX imposes no such constraint)!
*/
#define sched_rr_get_interval(_pid, _interval) \
( errno = ENOTSUP, (int) -1 )
__PTW32_END_C_DECLS
#undef __SCHED_H_SOURCED__
#endif /* !_SCHED_H */

View File

@ -0,0 +1,118 @@
/*
* Module: semaphore.h
*
* Purpose:
* Semaphores aren't actually part of the PThreads standard.
* They are defined by the POSIX Standard:
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads4w - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999-2018, Pthreads4w contributors
*
* Homepage: https://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* https://sourceforge.net/p/pthreads4w/wiki/Contributors/
*
* This file is part of Pthreads4w.
*
* Pthreads4w is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pthreads4w is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pthreads4w. If not, see <http://www.gnu.org/licenses/>. *
*/
#if !defined( SEMAPHORE_H )
#define SEMAPHORE_H
/* FIXME: POSIX.1 says that _POSIX_SEMAPHORES should be defined
* in <unistd.h>, not here; for later POSIX.1 versions, its value
* should match the corresponding _POSIX_VERSION number, but in
* the case of POSIX.1b-1993, the value is unspecified.
*
* Notwithstanding the above, since POSIX semaphores, (and indeed
* having any <unistd.h> to #include), are not a standard feature
* on MS-Windows, it is convenient to retain this definition here;
* we may consider adding a hook, to make it selectively available
* for inclusion by <unistd.h>, in those cases (e.g. MinGW) where
* <unistd.h> is provided.
*/
#define _POSIX_SEMAPHORES
/* Internal macros, common to the public interfaces for various
* Pthreads4w components, are defined in <_ptw32.h>; we must
* include them here.
*/
#include <_ptw32.h>
/* The sem_timedwait() function was added in POSIX.1-2001; it
* requires struct timespec to be defined, at least as a partial
* (a.k.a. incomplete) data type. Forward declare it as such,
* then include <time.h> selectively, to acquire a complete
* definition, (if available).
*/
struct timespec;
#define __need_struct_timespec
#include <time.h>
/* The data type used to represent our semaphore implementation,
* as required by POSIX.1; FIXME: consider renaming the underlying
* structure tag, to avoid possible pollution of user namespace.
*/
typedef struct sem_t_ * sem_t;
/* POSIX.1b (and later) mandates SEM_FAILED as the value to be
* returned on failure of sem_open(); (our implementation is a
* stub, which will always return this).
*/
#define SEM_FAILED (sem_t *)(-1)
__PTW32_BEGIN_C_DECLS
/* Function prototypes: some are implemented as stubs, which
* always fail; (FIXME: identify them).
*/
PTW32_DLLPORT int PTW32_CDECL sem_init (sem_t * sem,
int pshared,
unsigned int value);
PTW32_DLLPORT int PTW32_CDECL sem_destroy (sem_t * sem);
PTW32_DLLPORT int PTW32_CDECL sem_trywait (sem_t * sem);
PTW32_DLLPORT int PTW32_CDECL sem_wait (sem_t * sem);
PTW32_DLLPORT int PTW32_CDECL sem_timedwait (sem_t * sem,
const struct timespec * abstime);
PTW32_DLLPORT int PTW32_CDECL sem_post (sem_t * sem);
PTW32_DLLPORT int PTW32_CDECL sem_post_multiple (sem_t * sem,
int count);
PTW32_DLLPORT sem_t * PTW32_CDECL sem_open (const char *, int, ...);
PTW32_DLLPORT int PTW32_CDECL sem_close (sem_t * sem);
PTW32_DLLPORT int PTW32_CDECL sem_unlink (const char * name);
PTW32_DLLPORT int PTW32_CDECL sem_getvalue (sem_t * sem,
int * sval);
__PTW32_END_C_DECLS
#endif /* !SEMAPHORE_H */

View File

@ -1,183 +0,0 @@
/*
* Module: sched.h
*
* Purpose:
* Provides an implementation of POSIX realtime extensions
* as defined in
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(_SCHED_H)
#define _SCHED_H
#undef PTW32_SCHED_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_SCHED_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_SCHED_LEVEL
#define PTW32_SCHED_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_SCHED_LEVEL
#define PTW32_SCHED_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_SCHED_LEVEL_MAX 3
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL)
#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
/* Include everything */
#endif
#if defined(__GNUC__) && !defined(__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the library, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the library,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#if !defined(PTW32_STATIC_LIB)
# if defined(PTW32_BUILD)
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#if !defined(PTW32_CONFIG_H)
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(__MINGW64__)
# define HAVE_STRUCT_TIMESPEC
# define HAVE_MODE_T
# elif defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
#if defined(NEED_ERRNO)
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */
#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN)
# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
/* For pid_t */
# include <sys/types.h>
/* Required by Unix 98 */
# include <time.h>
# else
typedef int pid_t;
# endif
#else
typedef int pid_t;
#endif
/* Thread scheduling policies */
enum {
SCHED_OTHER = 0,
SCHED_FIFO,
SCHED_RR,
SCHED_MIN = SCHED_OTHER,
SCHED_MAX = SCHED_RR
};
struct sched_param {
int sched_priority;
};
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
PTW32_DLLPORT int __cdecl sched_yield (void);
PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
/*
* Note that this macro returns ENOTSUP rather than
* ENOSYS as might be expected. However, returning ENOSYS
* should mean that sched_get_priority_{min,max} are
* not implemented as well as sched_rr_get_interval.
* This is not the case, since we just don't support
* round-robin scheduling. Therefore I have chosen to
* return the same value as sched_setscheduler when
* SCHED_RR is passed to it.
*/
#define sched_rr_get_interval(_pid, _interval) \
( errno = ENOTSUP, (int) -1 )
#if defined(__cplusplus)
} /* End of extern "C" */
#endif /* __cplusplus */
#undef PTW32_SCHED_LEVEL
#undef PTW32_SCHED_LEVEL_MAX
#endif /* !_SCHED_H */

View File

@ -1,169 +0,0 @@
/*
* Module: semaphore.h
*
* Purpose:
* Semaphores aren't actually part of the PThreads standard.
* They are defined by the POSIX Standard:
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined( SEMAPHORE_H )
#define SEMAPHORE_H
#undef PTW32_SEMAPHORE_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_SEMAPHORE_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_SEMAPHORE_LEVEL
#define PTW32_SEMAPHORE_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_SEMAPHORE_LEVEL
#define PTW32_SEMAPHORE_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_SEMAPHORE_LEVEL_MAX 3
#if !defined(PTW32_SEMAPHORE_LEVEL)
#define PTW32_SEMAPHORE_LEVEL PTW32_SEMAPHORE_LEVEL_MAX
/* Include everything */
#endif
#if defined(__GNUC__) && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the library, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the library,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#if !defined(PTW32_STATIC_LIB)
# if defined(PTW32_BUILD)
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#if !defined(PTW32_CONFIG_H)
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(__MINGW64__)
# define HAVE_STRUCT_TIMESPEC
# define HAVE_MODE_T
# elif defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX
#if defined(NEED_ERRNO)
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */
#define _POSIX_SEMAPHORES
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
#if !defined(HAVE_MODE_T)
typedef unsigned int mode_t;
#endif
typedef struct sem_t_ * sem_t;
PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
int pshared,
unsigned int value);
PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
const struct timespec * abstime);
PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
int count);
PTW32_DLLPORT int __cdecl sem_open (const char * name,
int oflag,
mode_t mode,
unsigned int value);
PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
int * sval);
#if defined(__cplusplus)
} /* End of extern "C" */
#endif /* __cplusplus */
#undef PTW32_SEMAPHORE_LEVEL
#undef PTW32_SEMAPHORE_LEVEL_MAX
#endif /* !SEMAPHORE_H */

View File

@ -226,7 +226,8 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/debug/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-i686d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -256,7 +257,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/static/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-i686.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_SSE2|Win32'">
@ -286,7 +288,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/static/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-i686.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|Win32'">
@ -316,7 +319,6 @@
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<SubSystem>Console</SubSystem>
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/shared/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -334,8 +336,8 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion>5.2</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/debug/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-x64d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -365,8 +367,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<MinimumRequiredVersion>5.2</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/static/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_SSE2|x64'">
@ -396,8 +398,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<MinimumRequiredVersion>5.2</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/static/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libpthreadVC2-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'">
@ -427,8 +429,6 @@
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<SubSystem>Console</SubSystem>
<MinimumRequiredVersion>5.2</MinimumRequiredVersion>
<AdditionalLibraryDirectories>$(ProjectDir)../etc/deps/pthreadw32/lib/$(PlatformToolset)/shared/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -203,7 +203,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
@ -222,7 +222,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -254,7 +254,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -286,7 +286,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_DLL;SLUNKCRYPT_SHARED=1;SLUNKCRYPT_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -305,6 +305,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\shared;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2-i686.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -314,7 +316,7 @@
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
@ -333,7 +335,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -365,7 +367,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -397,7 +399,7 @@
<PreprocessorDefinitions>NDEBUG;_DLL;SLUNKCRYPT_SHARED=1;SLUNKCRYPT_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreadw32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)..\etc\deps\pthreads4w\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@ -416,6 +418,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(ProjectDir)..\etc\deps\pthreads4w\lib\msvc-v141\shared;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>pthreadVC2-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />