mirror of https://github.com/PCSX2/pcsx2.git
Add local pthread changes.
- Move the 3 public headers to a include directory. + pthreads ships a config.h therefore leaving them in the top dir pollutes the include path. - Starting with VS2015, MS defines timespec. Declare to only have it if _MSC_VER >= 1900. - On Linux pthread_t is an integer and you can easily do ==. On Windows pthread_t is a structure and ==/!= have to be overloaded or every use of those operator must be guaded with #ifdef's.
This commit is contained in:
parent
70aba9d3ff
commit
05500bf759
|
@ -137,6 +137,10 @@
|
||||||
#define HAVE_MODE_T
|
#define HAVE_MODE_T
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1900
|
||||||
|
#define HAVE_STRUCT_TIMESPEC
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,10 @@
|
||||||
# pragma comment(lib, "pthread")
|
# pragma comment(lib, "pthread")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1900
|
||||||
|
# define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
@ -577,9 +581,24 @@ extern "C"
|
||||||
* that available with a simple pointer. It should scale for either
|
* that available with a simple pointer. It should scale for either
|
||||||
* IA-32 or IA-64.
|
* IA-32 or IA-64.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct ptw32_handle_t {
|
||||||
void * p; /* Pointer to actual object */
|
void * p; /* Pointer to actual object */
|
||||||
unsigned int x; /* Extra information - reuse count etc */
|
unsigned int x; /* Extra information - reuse count etc */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
// Added support for various operators so that the struct is
|
||||||
|
// more pthreads-compliant in behavior. (air)
|
||||||
|
const bool operator ==( const struct ptw32_handle_t rightside ) const
|
||||||
|
{
|
||||||
|
return p == rightside.p;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool operator !=( const struct ptw32_handle_t rightside ) const
|
||||||
|
{
|
||||||
|
return p != rightside.p;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} ptw32_handle_t;
|
} ptw32_handle_t;
|
||||||
|
|
||||||
typedef ptw32_handle_t pthread_t;
|
typedef ptw32_handle_t pthread_t;
|
Loading…
Reference in New Issue