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:
Miguel A. Colón Vélez 2015-08-25 09:51:16 -04:00
parent 70aba9d3ff
commit 05500bf759
4 changed files with 24 additions and 1 deletions

View File

@ -137,6 +137,10 @@
#define HAVE_MODE_T
#endif
#if _MSC_VER >= 1900
#define HAVE_STRUCT_TIMESPEC
#endif
#if defined(__BORLANDC__)
#endif

View File

@ -116,6 +116,10 @@
# pragma comment(lib, "pthread")
#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
* IA-32 or IA-64.
*/
typedef struct {
typedef struct ptw32_handle_t {
void * p; /* Pointer to actual object */
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;
typedef ptw32_handle_t pthread_t;