patch for taking notice of UPNP_USE_RWLOCK flag in threadutil

By "Carl Benson" <carl.benson@windriver.com>:

I had to do some modifications myself though, because the Android
build system insists on having a file named "util.h" taking precedence
in its include path, libupnp gets confused because of the same filename
in upnp/src/inc/util.h

(hand cherry picked from commit 8e846368e0)
This commit is contained in:
Carl Benson 2010-11-01 00:43:20 -02:00 committed by Marcelo Roberto Jimenez
parent c2fbc12362
commit 4d37927c64
19 changed files with 50 additions and 21 deletions

View File

@ -217,6 +217,19 @@ Version 1.8.0
* Rewrote Peter Hartley's patch to include a new extra header field in * Rewrote Peter Hartley's patch to include a new extra header field in
FileInfo. FileInfo.
*******************************************************************************
Version 1.6.9
*******************************************************************************
2010-11-01 Carl Benson <carl.benson(at)windriver.com>
Fix for Android build.
I had to do some modifications myself though, because the Android
build system insists on having a file named "util.h" taking precedence
in its include path, libupnp gets confused because of the same filename
in upnp/src/inc/util.h
******************************************************************************* *******************************************************************************
Version 1.6.8 Version 1.6.8
******************************************************************************* *******************************************************************************

1
THANKS
View File

@ -13,6 +13,7 @@ exempt of errors.
- Arno Willig - Arno Willig
- Bob Ciora - Bob Ciora
- Carlo Parata - Carlo Parata
- Carl Benson
- Chandra (inactiveneurons) - Chandra (inactiveneurons)
- Chaos - Chaos
- Charles Nepveu (cnepveu) - Charles Nepveu (cnepveu)

View File

@ -188,7 +188,10 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
* Internal Use Only * Internal Use Only
***************************************************************************/ ***************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
typedef pthread_rwlock_t ithread_rwlock_t; typedef pthread_rwlock_t ithread_rwlock_t;
#else
/* Read-write locks aren't available: use mutex instead. */
typedef ithread_mutex_t ithread_rwlock_t;
#endif /* UPNP_USE_RWLOCK */ #endif /* UPNP_USE_RWLOCK */
@ -337,7 +340,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
#define ithread_mutexattr_setkind_np pthread_mutexattr_settype #define ithread_mutexattr_setkind_np pthread_mutexattr_settype
#else #else
#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np #define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
#endif #endif /* UPNP_USE_RWLOCK */
/**************************************************************************** /****************************************************************************
* Function: ithread_mutexattr_getkind_np * Function: ithread_mutexattr_getkind_np
@ -362,7 +365,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype #define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
#else #else
#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np #define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
#endif #endif /* UPNP_USE_RWLOCK */
/**************************************************************************** /****************************************************************************
@ -536,8 +539,10 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
*****************************************************************************/ *****************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
#define ithread_rwlock_init pthread_rwlock_init #define ithread_rwlock_init pthread_rwlock_init
#endif /* UPNP_USE_RWLOCK */ #else
/* Read-write locks aren't available: use mutex instead. */
#define ithread_rwlock_init ithread_mutex_init
#endif
/**************************************************************************** /****************************************************************************
* Function: ithread_rwlock_rdlock * Function: ithread_rwlock_rdlock
@ -555,9 +560,11 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
*****************************************************************************/ *****************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
#define ithread_rwlock_rdlock pthread_rwlock_rdlock #define ithread_rwlock_rdlock pthread_rwlock_rdlock
#else
/* Read-write locks aren't available: use mutex instead. */
#define ithread_rwlock_rdlock ithread_mutex_lock
#endif /* UPNP_USE_RWLOCK */ #endif /* UPNP_USE_RWLOCK */
/**************************************************************************** /****************************************************************************
* Function: ithread_rwlock_wrlock * Function: ithread_rwlock_wrlock
* *
@ -574,6 +581,9 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
*****************************************************************************/ *****************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
#define ithread_rwlock_wrlock pthread_rwlock_wrlock #define ithread_rwlock_wrlock pthread_rwlock_wrlock
#else
/* Read-write locks aren't available: use mutex instead. */
#define ithread_rwlock_wrlock ithread_mutex_lock
#endif /* UPNP_USE_RWLOCK */ #endif /* UPNP_USE_RWLOCK */
@ -594,6 +604,9 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
*****************************************************************************/ *****************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
#define ithread_rwlock_unlock pthread_rwlock_unlock #define ithread_rwlock_unlock pthread_rwlock_unlock
#else
/* Read-write locks aren't available: use mutex instead. */
#define ithread_rwlock_unlock ithread_mutex_unlock
#endif /* UPNP_USE_RWLOCK */ #endif /* UPNP_USE_RWLOCK */
@ -615,6 +628,9 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
*****************************************************************************/ *****************************************************************************/
#if UPNP_USE_RWLOCK #if UPNP_USE_RWLOCK
#define ithread_rwlock_destroy pthread_rwlock_destroy #define ithread_rwlock_destroy pthread_rwlock_destroy
#else
/* Read-write locks aren't available: use mutex instead. */
#define ithread_rwlock_destroy ithread_mutex_destroy
#endif /* UPNP_USE_RWLOCK */ #endif /* UPNP_USE_RWLOCK */

View File

@ -122,6 +122,7 @@ ithread_mutex_t GlobalClientSubscribeMutex;
/*! rwlock to synchronize handles (root device or control point handle). */ /*! rwlock to synchronize handles (root device or control point handle). */
ithread_rwlock_t GlobalHndRWLock; ithread_rwlock_t GlobalHndRWLock;
/*! Mutex to synchronize the uuid creation process. */ /*! Mutex to synchronize the uuid creation process. */
ithread_mutex_t gUUIDMutex; ithread_mutex_t gUUIDMutex;

View File

@ -57,7 +57,7 @@
#include "ThreadPool.h" #include "ThreadPool.h"
#include "unixutil.h" /* for socklen_t, EAFNOSUPPORT */ #include "unixutil.h" /* for socklen_t, EAFNOSUPPORT */
#include "upnpapi.h" #include "upnpapi.h"
#include "util.h" #include "upnputil.h"
#include <assert.h> #include <assert.h>

View File

@ -36,7 +36,7 @@
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#include "util.h" #include "upnputil.h"
#include "membuffer.h" #include "membuffer.h"
#include "httpparser.h" #include "httpparser.h"
#include "statcodes.h" #include "statcodes.h"

View File

@ -37,7 +37,7 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "util.h" #include "upnputil.h"
#include "statcodes.h" #include "statcodes.h"
#ifdef WIN32 #ifdef WIN32

View File

@ -52,7 +52,7 @@
#include "unixutil.h" #include "unixutil.h"
#include "upnp.h" #include "upnp.h"
#include "upnpapi.h" #include "upnpapi.h"
#include "util.h" #include "upnputil.h"
#include "VirtualDir.h" #include "VirtualDir.h"
#include <assert.h> #include <assert.h>

View File

@ -37,7 +37,7 @@
#include "config.h" #include "config.h"
#include "upnp.h" #include "upnp.h"
#include "util.h" #include "upnputil.h"
#include <string.h> #include <string.h>

View File

@ -42,7 +42,7 @@
#include "LinkedList.h" #include "LinkedList.h"
#include "membuffer.h" #include "membuffer.h"
#include "uri.h" #include "uri.h"
#include "util.h" #include "upnputil.h"
////// private types //////////// ////// private types ////////////

View File

@ -33,7 +33,7 @@
#define GENLIB_NET_HTTP_HTTPREADWRITE_H #define GENLIB_NET_HTTP_HTTPREADWRITE_H
#include "config.h" #include "config.h"
#include "util.h" #include "upnputil.h"
#include "sock.h" #include "sock.h"
#include "httpparser.h" #include "httpparser.h"

View File

@ -34,7 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "util.h" #include "upnputil.h"
#define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) ) #define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) )
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) ) #define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )

View File

@ -32,7 +32,7 @@
#ifndef GENLIB_NET_HTTP_PARSETOOLS_H #ifndef GENLIB_NET_HTTP_PARSETOOLS_H
#define GENLIB_NET_HTTP_PARSETOOLS_H #define GENLIB_NET_HTTP_PARSETOOLS_H
#include "util.h" #include "upnputil.h"
#include "httpparser.h" #include "httpparser.h"

View File

@ -36,7 +36,7 @@
* \file * \file
*/ */
#include "util.h" #include "upnputil.h"
#ifdef WIN32 #ifdef WIN32
/* Do not #include <netinet/in.h> */ /* Do not #include <netinet/in.h> */

View File

@ -33,7 +33,7 @@
#define GENLIB_UTIL_STRINTMAP_H #define GENLIB_UTIL_STRINTMAP_H
#include <stdlib.h> #include <stdlib.h>
#include "util.h" #include "upnputil.h"
// Util to map from a string to an integer and vice versa // Util to map from a string to an integer and vice versa

View File

@ -109,10 +109,8 @@ struct Handle_Info
#endif #endif
}; };
extern ithread_rwlock_t GlobalHndRWLock; extern ithread_rwlock_t GlobalHndRWLock;
/*! /*!
* \brief Get handle information. * \brief Get handle information.
* *

View File

@ -33,7 +33,7 @@
#include "config.h" #include "config.h"
#include "util.h" #include "upnputil.h"
#ifdef INCLUDE_CLIENT_APIS #ifdef INCLUDE_CLIENT_APIS

View File

@ -40,7 +40,7 @@
#include "UpnpInet.h" #include "UpnpInet.h"
#include "uri.h" #include "uri.h"
#include "urlconfig.h" #include "urlconfig.h"
#include "util.h" #include "upnputil.h"
#include "webserver.h" #include "webserver.h"