w32pthreads: (Upgrade to v4) Added pthread_cond and pthread_rwlock APIs.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2910 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-04-27 13:06:03 +00:00
parent d33e2edb48
commit c440cb563a
27 changed files with 306 additions and 103 deletions

View File

@ -37,8 +37,10 @@
* 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,8,0,3
#define PTW32_VERSION_STRING "2, 8, 0, 3\0"
#define PTW32_VERSION 2,8,0,4
#define PTW32_VERSION_STRING "2, 8, 0, 4\0"
#define PTW32_ALLOW_COND
/* There are three implementations of cancel cleanup.
* Note that pthread.h is included in both application
@ -65,7 +67,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.

View File

@ -35,8 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_cond_destroy (pthread_cond_t * cond)

View File

@ -35,8 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int

View File

@ -39,8 +39,7 @@
* See the comments at the top of pthread_cond_wait.c.
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
static INLINE int
ptw32_cond_unblock (pthread_cond_t * cond, int unblockAll)

View File

@ -258,8 +258,7 @@
*
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
/*
* Arguments for cond_wait_cleanup, since we can only pass a

View File

@ -35,9 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_condattr_destroy (pthread_condattr_t * attr)

View File

@ -35,9 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared)

View File

@ -35,9 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_condattr_init (pthread_condattr_t * attr)

View File

@ -35,8 +35,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_destroy (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_init (pthread_rwlock_t * rwlock,

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_rdlock (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_timedrdlock (pthread_rwlock_t * rwlock,

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_timedwrlock (pthread_rwlock_t * rwlock,

View File

@ -34,11 +34,18 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "ptw32pch.h"
#include "pthread.h"
#include "implement.h"
// FIXME : This function can return EBUSY when the rwlock is available for reading.
// How? Because it uses a single "mtxExclusiveAccess" lock to wrangle control of the
// RwLock's internals -- so if two read locks are attempted in parallel, this function
// will falsely report the lock as being busy even though both locks should be allowed
// access to the object.
//
// (note: double check this against OpenGroup behavior definitions -- though even if
// OpenGroup 'allows' this behavior, we should probably strive to avoid it unless
// it's explicitly "expected", since programs would typically have much more desirable
// behavior if simultaneous read locks do not EBUSY.)
int
pthread_rwlock_tryrdlock (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_trywrlock (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "ptw32pch.h"
#include "pthread.h"
#include "implement.h"
int
pthread_rwlock_unlock (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlock_wrlock (pthread_rwlock_t * rwlock)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr)

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,

View File

@ -34,11 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
#include "ptw32pch.h"
int
pthread_rwlockattr_init (pthread_rwlockattr_t * attr)

View File

@ -34,12 +34,11 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "ptw32pch.h"
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"
int
pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, int pshared)
/*

View File

@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="w32pthreads.v3"
Name="w32pthreads.v4"
ProjectGUID="{26511268-2902-4997-8421-ECD7055F9E28}"
RootNamespace="pthreads"
Keyword="Win32Proj"
@ -514,12 +514,63 @@
<Filter
Name="rwlock"
>
<File
RelativePath=".\pthread_rwlock_destroy.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_init.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_rdlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_timedrdlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_timedwrlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_tryrdlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_trywrlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_unlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlock_wrlock.c"
>
</File>
<File
RelativePath=".\pthread_rwlockattr_destroy.c"
>
</File>
<File
RelativePath=".\pthread_rwlockattr_getpshared.c"
>
</File>
<File
RelativePath=".\pthread_rwlockattr_init.c"
>
</File>
<File
RelativePath=".\pthread_rwlockattr_setpshared.c"
>
</File>
<File
RelativePath=".\ptw32_rwlock_cancelwrwait.c"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -527,7 +578,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -535,7 +585,6 @@
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -547,7 +596,6 @@
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -555,7 +603,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -563,7 +610,6 @@
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -575,11 +621,210 @@
Name="cond"
>
<File
RelativePath=".\pthread_timechange_handler_np.c"
RelativePath=".\pthread_cond_destroy.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_cond_init.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_cond_signal.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_cond_wait.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_condattr_destroy.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_condattr_getpshared.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_condattr_init.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_condattr_setpshared.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pthread_timechange_handler_np.c"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -587,7 +832,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -595,7 +839,6 @@
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -607,7 +850,6 @@
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -615,7 +857,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -623,7 +864,6 @@
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"

View File

@ -2,3 +2,7 @@
// Pcsx2-specific Feature: Precompiled Header support!
#include "ptw32pch.h"
#ifndef PTW32_BUILD
# pragma comment(lib, "w32pthreads.v4.lib")
#endif

View File

@ -4,6 +4,9 @@
#ifndef _PTHREAD_W32_PCH_
#define _PTHREAD_W32_PCH_
#include <errno.h>
#include <limits.h>
#include "pthread.h"
#include "implement.h"

View File

@ -7,7 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxresmw.h"
#include "afxresmw.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -50,7 +51,7 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,8,3,0
FILEVERSION 2,8,4,0
PRODUCTVERSION 2,8,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
@ -68,10 +69,10 @@ BEGIN
BEGIN
VALUE "Comments", "Built for PCSX2 (SEH, CDECL, Align16)"
VALUE "FileDescription", "POSIX Threads for Win32"
VALUE "FileVersion", "2.8.pxr3"
VALUE "FileVersion", "2.8.pxr4"
VALUE "InternalName", "w32pthreads"
VALUE "LegalCopyright", "Copyright (C) 2009"
VALUE "OriginalFilename", "w32pthreads.v3"
VALUE "OriginalFilename", "w32pthreads.v4"
VALUE "ProductName", "w32pthreads"
VALUE "ProductVersion", "2.8"
END
@ -92,7 +93,8 @@ END
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -55,7 +55,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "3rdparty\bzip2\bzi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LilyPad", "plugins\LilyPad\LilyPad_VC2008.vcproj", "{E4081455-398C-4610-A87C-90A8A7D72DC3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w32pthreads.v3", "3rdparty\w32pthreads\pthreads_2008.vcproj", "{26511268-2902-4997-8421-ECD7055F9E28}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w32pthreads.v4", "3rdparty\w32pthreads\pthreads_2008.vcproj", "{26511268-2902-4997-8421-ECD7055F9E28}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroSPU2", "plugins\zerospu2\Windows\ZeroSPU2_2008.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}"
ProjectSection(ProjectDependencies) = postProject