* Added API to ithread, created the following functions:
- int ithread_initialize_library(void); - int ithread_cleanup_library(void); - int ithread_initialize_thread(void); - int ithread_cleanup_thread(void); * SF Bug Tracker [ 2876374 ] Access Violation when compiling with Visual Studio 2008 Submitted: Stulle ( stulleamgym ) - 2009-10-10 19:05 Hi, I am one of the devs of the MorphXT project and I use this lib in some other of my projects, too. When I tried to upgrade the lib earlier for one of my projects I had to realise that something did not work at first and while most of the things were reasonably ease to be fixed. Now, the last thing I encountered was not so easy to fix and I am uncertain if my fix is any good so I'll just post it here and wait for some comments. The problem was that I got an Access Violation when calling "UpnpInit". It would call "ithread_rwlock_init(&GlobalHndRWLock, NULL)" which eventually led to calling "pthread_cond_init" and I got the error notice at "EnterCriticalSection (&ptw32_cond_list_lock);". It appeared that "ptw32_cond_list_lock" was NULL. Now, I found two ways to fix this. Firstly moving the whole block after at least one of the "ThreadPoolInit" calls will fix the issue. Secondly, you could add: #ifdef WIN32 #ifdef PTW32_STATIC_LIB // to get the following working we need this... is it a good patch or not... I do not know! pthread_win32_process_attach_np(); #endif #endif right before "ithread_rwlock_init(&GlobalHndRWLock, NULL)". Just so you know, I am using libupnp 1.6.6 and libpthreads 2.8.0 and both are linked static into the binaries. I am currently using Visual Studio 2008 for development with Windows being the target OS. Any comment at your end? Regards, Stulle git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@527 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
9c440e2cbf
commit
3fb182aa95
43
ChangeLog
43
ChangeLog
@ -2,7 +2,48 @@
|
|||||||
Version 1.8.0
|
Version 1.8.0
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* Added API to ithread, created the following functions:
|
||||||
|
- int ithread_initialize_library(void);
|
||||||
|
- int ithread_cleanup_library(void);
|
||||||
|
- int ithread_initialize_thread(void);
|
||||||
|
- int ithread_cleanup_thread(void);
|
||||||
|
* SF Bug Tracker [ 2876374 ] Access Violation when compiling with Visual Studio 2008
|
||||||
|
Submitted: Stulle ( stulleamgym ) - 2009-10-10 19:05
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
I am one of the devs of the MorphXT project and I use this lib in some
|
||||||
|
other of my projects, too. When I tried to upgrade the lib earlier for one
|
||||||
|
of my projects I had to realise that something did not work at first and
|
||||||
|
while most of the things were reasonably ease to be fixed. Now, the last
|
||||||
|
thing I encountered was not so easy to fix and I am uncertain if my fix is
|
||||||
|
any good so I'll just post it here and wait for some comments.
|
||||||
|
|
||||||
|
The problem was that I got an Access Violation when calling "UpnpInit". It
|
||||||
|
would call "ithread_rwlock_init(&GlobalHndRWLock, NULL)" which eventually
|
||||||
|
led to calling "pthread_cond_init" and I got the error notice at
|
||||||
|
"EnterCriticalSection (&ptw32_cond_list_lock);". It appeared that
|
||||||
|
"ptw32_cond_list_lock" was NULL. Now, I found two ways to fix this. Firstly
|
||||||
|
moving the whole block after at least one of the "ThreadPoolInit" calls
|
||||||
|
will fix the issue. Secondly, you could add:
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifdef PTW32_STATIC_LIB
|
||||||
|
// to get the following working we need this... is it a good patch or
|
||||||
|
not... I do not know!
|
||||||
|
pthread_win32_process_attach_np();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
right before "ithread_rwlock_init(&GlobalHndRWLock, NULL)".
|
||||||
|
|
||||||
|
Just so you know, I am using libupnp 1.6.6 and libpthreads 2.8.0 and both
|
||||||
|
are linked static into the binaries. I am currently using Visual Studio
|
||||||
|
2008 for development with Windows being the target OS. Any comment at your
|
||||||
|
end?
|
||||||
|
|
||||||
|
Regards, Stulle
|
||||||
|
|
||||||
|
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Forward port of svn revision 505:
|
* Forward port of svn revision 505:
|
||||||
SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
||||||
Submitted By: zephyrus ( zephyrus00jp )
|
Submitted By: zephyrus ( zephyrus00jp )
|
||||||
|
@ -154,14 +154,19 @@ dnl # current: 3 -> 4
|
|||||||
dnl # revision: 6 -> 0
|
dnl # revision: 6 -> 0
|
||||||
dnl # - Interface has been removed in upnp
|
dnl # - Interface has been removed in upnp
|
||||||
dnl # age = 0
|
dnl # age = 0
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 3 -> 4
|
||||||
|
dnl # - Interfaces have been changed, added and removed in upnp
|
||||||
|
dnl # current: 4 -> 5
|
||||||
|
dnl # revision: 4 -> 0
|
||||||
dnl #
|
dnl #
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2])
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
dnl #AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
||||||
dnl #
|
dnl #
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2])
|
AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
|
||||||
AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||||
|
@ -30,19 +30,21 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef ITHREADH
|
#ifndef ITHREAD_H
|
||||||
#define ITHREADH
|
#define ITHREAD_H
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \file
|
* \file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ! defined(WIN32)
|
|
||||||
|
#if !defined(WIN32)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "UpnpGlobal.h" /* For EXPORT_SPEC */
|
|
||||||
|
#include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -94,6 +96,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_t ithread_t;
|
typedef pthread_t ithread_t;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ithread_attr_t
|
* Name: ithread_attr_t
|
||||||
*
|
*
|
||||||
@ -112,7 +115,7 @@ typedef pthread_attr_t ithread_attr_t;
|
|||||||
* Thread start routine
|
* Thread start routine
|
||||||
* Internal Use Only.
|
* Internal Use Only.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef void * (*start_routine) (void *arg);
|
typedef void *(*start_routine)(void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -181,6 +184,95 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_rwlock_t ithread_rwlock_t;
|
typedef pthread_rwlock_t ithread_rwlock_t;
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_initialize_library
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initializes the library. Does nothing in all implementations, except
|
||||||
|
* when statically linked for WIN32.
|
||||||
|
* Parameters:
|
||||||
|
* none.
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
***************************************************************************/
|
||||||
|
static UPNP_INLINE int ithread_initialize_library(void) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||||
|
ret = !pthread_win32_process_attach_np();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_cleanup_library
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Clean up library resources. Does nothing in all implementations, except
|
||||||
|
* when statically linked for WIN32.
|
||||||
|
* Parameters:
|
||||||
|
* none.
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
***************************************************************************/
|
||||||
|
static UPNP_INLINE int ithread_cleanup_library(void) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||||
|
ret = !pthread_win32_process_detach_np();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_initialize_thread
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initializes the thread. Does nothing in all implementations, except
|
||||||
|
* when statically linked for WIN32.
|
||||||
|
* Parameters:
|
||||||
|
* none.
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
***************************************************************************/
|
||||||
|
static UPNP_INLINE int ithread_initialize_thread(void) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||||
|
ret = !pthread_win32_thread_attach_np();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_cleanup_thread
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Clean up thread resources. Does nothing in all implementations, except
|
||||||
|
* when statically linked for WIN32.
|
||||||
|
* Parameters:
|
||||||
|
* none.
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
***************************************************************************/
|
||||||
|
static UPNP_INLINE int ithread_cleanup_thread(void) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||||
|
ret = !pthread_win32_thread_detach_np();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_mutexattr_init
|
* Function: ithread_mutexattr_init
|
||||||
*
|
*
|
||||||
@ -420,8 +512,8 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Must be called before use.
|
* Must be called before use.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
* const ithread_rwlockattr_t * rwlock_attr
|
* const ithread_rwlockattr_t *rwlock_attr
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
@ -436,7 +528,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Description:
|
* Description:
|
||||||
* Locks rwlock for reading.
|
* Locks rwlock for reading.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
* rwlock must be initialized.
|
* rwlock must be initialized.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -453,7 +545,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Description:
|
* Description:
|
||||||
* Locks rwlock for writting.
|
* Locks rwlock for writting.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
* rwlock must be initialized.
|
* rwlock must be initialized.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -471,7 +563,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Unlocks rwlock.
|
* Unlocks rwlock.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
* rwlock must be initialized.
|
* rwlock must be initialized.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -491,7 +583,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* rwlock is only destroyed when there are no longer any threads waiting on it.
|
* rwlock is only destroyed when there are no longer any threads waiting on it.
|
||||||
* rwlock cannot be destroyed if it is locked.
|
* rwlock cannot be destroyed if it is locked.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
* rwlock must be initialized.
|
* rwlock must be initialized.
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success. Nonzero on failure.
|
* 0 on success. Nonzero on failure.
|
||||||
@ -508,8 +600,8 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Initializes condition variable.
|
* Initializes condition variable.
|
||||||
* Must be called before use.
|
* Must be called before use.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to pthread_cond_t)
|
* ithread_cond_t *cond (must be valid non NULL pointer to pthread_cond_t)
|
||||||
* const ithread_condattr_t * cond_attr (ignored)
|
* const ithread_condattr_t *cond_attr (ignored)
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* See man page for pthread_cond_init
|
* See man page for pthread_cond_init
|
||||||
@ -517,7 +609,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_cond_init pthread_cond_init
|
#define ithread_cond_init pthread_cond_init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_cond_signal
|
* Function: ithread_cond_signal
|
||||||
*
|
*
|
||||||
@ -525,7 +616,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Wakes up exactly one thread waiting on condition.
|
* Wakes up exactly one thread waiting on condition.
|
||||||
* Associated mutex MUST be locked by thread before entering this call.
|
* Associated mutex MUST be locked by thread before entering this call.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to
|
||||||
* ithread_cond_t)
|
* ithread_cond_t)
|
||||||
* cond must be initialized
|
* cond must be initialized
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -542,7 +633,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Wakes up all threads waiting on condition.
|
* Wakes up all threads waiting on condition.
|
||||||
* Associated mutex MUST be locked by thread before entering this call.
|
* Associated mutex MUST be locked by thread before entering this call.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to
|
||||||
* ithread_cond_t)
|
* ithread_cond_t)
|
||||||
* cond must be initialized
|
* cond must be initialized
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -560,7 +651,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Associated mutex MUST be locked by thread before entering this call.
|
* Associated mutex MUST be locked by thread before entering this call.
|
||||||
* Mutex is reacquired when call returns.
|
* Mutex is reacquired when call returns.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to
|
||||||
* ithread_cond_t)
|
* ithread_cond_t)
|
||||||
* cond must be initialized
|
* cond must be initialized
|
||||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
||||||
@ -576,23 +667,19 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: pthread_cond_timedwait
|
* Function: pthread_cond_timedwait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Atomically releases the associated mutex and waits on the condition.
|
* Atomically releases the associated mutex and waits on the
|
||||||
* If the condition is not signaled in the specified time
|
* condition.
|
||||||
* than the
|
* If the condition is not signaled in the specified time than the
|
||||||
* call times out and returns.
|
* call times out and returns.
|
||||||
* Associated mutex MUST be locked by thread before entering
|
* Associated mutex MUST be locked by thread before entering this call.
|
||||||
* this call.
|
* Mutex is reacquired when call returns.
|
||||||
* Mutex is reacquired when call returns.
|
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to ithread_cond_t)
|
||||||
* ithread_cond_t)
|
* cond must be initialized
|
||||||
* cond must be initialized
|
* ithread_mutex_t *mutex (must be valid non NULL pointer to ithread_mutex_t)
|
||||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
* Mutex must be locked.
|
||||||
* ithread_mutex_t)
|
* const struct timespec *abstime (absolute time, measured from Jan 1, 1970)
|
||||||
* Mutex must be locked.
|
|
||||||
* const struct timespec *abstime (absolute time, measured
|
|
||||||
* from Jan 1, 1970)
|
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
||||||
* See man page for pthread_cond_timedwait
|
* See man page for pthread_cond_timedwait
|
||||||
@ -608,7 +695,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Releases any resources held by the condition variable.
|
* Releases any resources held by the condition variable.
|
||||||
* Condition variable can no longer be used after this call.
|
* Condition variable can no longer be used after this call.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to
|
||||||
* ithread_cond_t)
|
* ithread_cond_t)
|
||||||
* cond must be initialized.
|
* cond must be initialized.
|
||||||
* Returns:
|
* Returns:
|
||||||
@ -664,6 +751,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_exit pthread_exit
|
#define ithread_exit pthread_exit
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_get_current_thread_id
|
* Function: ithread_get_current_thread_id
|
||||||
*
|
*
|
||||||
@ -687,6 +775,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_self pthread_self
|
#define ithread_self pthread_self
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_detach
|
* Function: ithread_detach
|
||||||
*
|
*
|
||||||
@ -700,6 +789,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_detach pthread_detach
|
#define ithread_detach pthread_detach
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_join
|
* Function: ithread_join
|
||||||
*
|
*
|
||||||
@ -719,7 +809,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_join pthread_join
|
#define ithread_join pthread_join
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
*
|
*
|
||||||
@ -739,6 +828,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define isleep sleep
|
#define isleep sleep
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
*
|
*
|
||||||
@ -764,9 +854,11 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ITHREADH */
|
|
||||||
|
#endif /* ITHREAD_H */
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -204,6 +204,9 @@ int UpnpInit(const char *HostIP, unsigned short DestPort)
|
|||||||
{
|
{
|
||||||
int retVal = UPNP_E_SUCCESS;
|
int retVal = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
|
/* Initializes the ithread library */
|
||||||
|
ithread_initialize_library();
|
||||||
|
|
||||||
ithread_mutex_lock(&gSDKInitMutex);
|
ithread_mutex_lock(&gSDKInitMutex);
|
||||||
|
|
||||||
/* Check if we're already initialized. */
|
/* Check if we're already initialized. */
|
||||||
@ -257,6 +260,9 @@ int UpnpInit2(const char *IfName, unsigned short DestPort)
|
|||||||
{
|
{
|
||||||
int retVal;
|
int retVal;
|
||||||
|
|
||||||
|
/* Initializes the ithread library */
|
||||||
|
ithread_initialize_library();
|
||||||
|
|
||||||
ithread_mutex_lock(&gSDKInitMutex);
|
ithread_mutex_lock(&gSDKInitMutex);
|
||||||
|
|
||||||
/* Check if we're already initialized. */
|
/* Check if we're already initialized. */
|
||||||
@ -308,10 +314,6 @@ int UpnpFinish(void)
|
|||||||
#endif
|
#endif
|
||||||
struct Handle_Info *temp;
|
struct Handle_Info *temp;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
/*WSACleanup();*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -361,19 +363,15 @@ int UpnpFinish(void)
|
|||||||
ithread_rwlock_destroy(&GlobalHndRWLock);
|
ithread_rwlock_destroy(&GlobalHndRWLock);
|
||||||
ithread_mutex_destroy(&gUUIDMutex);
|
ithread_mutex_destroy(&gUUIDMutex);
|
||||||
|
|
||||||
// remove all virtual dirs
|
/* remove all virtual dirs */
|
||||||
UpnpRemoveAllVirtualDirs();
|
UpnpRemoveAllVirtualDirs();
|
||||||
|
|
||||||
// allow static linking
|
/* Clean-up ithread library resources */
|
||||||
#ifdef WIN32
|
ithread_cleanup_library();
|
||||||
#ifdef PTW32_STATIC_LIB
|
|
||||||
pthread_win32_thread_detach_np();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UpnpSdkInit = 0;
|
UpnpSdkInit = 0;
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Exiting UpnpFinish : UpnpSdkInit is :%d:\n", UpnpSdkInit);
|
"Exiting UpnpFinish: UpnpSdkInit is :%d:\n", UpnpSdkInit);
|
||||||
UpnpCloseLog();
|
UpnpCloseLog();
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user