Backport of svn revision 504:

SF Patch Tracker [ 2969188 ] 1.8.0: patch for FreeBSD compilation
	Submitted By: Nick Leverton (leveret)
	Fix the order of header inclusion for FreeBSD.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@509 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2010-03-21 15:42:40 +00:00
parent 9226dd833b
commit 5eb55e0fb2
9 changed files with 386 additions and 346 deletions

View File

@@ -29,22 +29,40 @@
*
******************************************************************************/
#ifndef ITHREADH
#define ITHREADH
/*!
* \file
*/
#if ! defined(WIN32)
#include <sys/param.h>
#endif
#include "UpnpGlobal.h" /* For EXPORT_SPEC */
#ifdef __cplusplus
extern "C" {
#endif
#include <pthread.h>
#ifndef WIN32
#ifdef WIN32
/* Do not #include <unistd.h> */
#else
#include <unistd.h>
#endif
#ifdef __FreeBSD__
#if defined(BSD)
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#ifdef PTHREAD_MUTEX_RECURSIVE
/* This system has SuS2-compliant mutex attributes.
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
@@ -715,10 +733,10 @@ typedef pthread_rwlock_t ithread_rwlock_t;
* 0 on success, Nonzero on failure.
* See man page for sleep (man 3 sleep)
*****************************************************************************/
#ifndef WIN32
#define isleep sleep
#ifdef WIN32
#define isleep(x) Sleep((x)*1000)
#else
#define isleep(x) Sleep((x)*1000)
#define isleep sleep
#endif
/****************************************************************************
@@ -734,25 +752,10 @@ typedef pthread_rwlock_t ithread_rwlock_t;
* 0 on success, Nonzero on failure.
* See man page for sleep (man 3 sleep)
*****************************************************************************/
#ifndef WIN32
#define imillisleep(x) usleep(1000*x)
#else
#define imillisleep Sleep
#endif
#ifdef WIN32
#ifndef UPNP_STATIC_LIB
#ifdef LIBUPNP_EXPORTS
/* set up declspec for dll export to make functions visible to library users */
#define EXPORT_SPEC __declspec(dllexport)
#else
#define EXPORT_SPEC __declspec(dllimport)
#endif
#else
#define EXPORT_SPEC
#endif
#define imillisleep Sleep
#else
#define EXPORT_SPEC
#define imillisleep(x) usleep(1000*x)
#endif