⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ithread.h

📁 Upnp开发包文件
💻 H
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////// Copyright (c) 2000-2003 Intel Corporation // All rights reserved. //// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: //// * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither name of Intel Corporation nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission.// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE./////////////////////////////////////////////////////////////////////////////#ifndef ITHREADH#define ITHREADH#ifdef __cplusplusextern "C" {#endif#ifdef DEBUG#define DEBUG_ONLY(x) x#else#define DEBUG_ONLY(x)#endif#include <pthread.h>#include <unistd.h>#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP#define ITHREAD_CANCELED PTHREAD_CANCELED      /***************************************************************************   * Name: ithread_t   *   *  Description:   *      Thread handle.   *      typedef to pthread_t.   *      Internal Use Only.   ***************************************************************************/  typedef pthread_t ithread_t;     /****************************************************************************   * Name: ithread_attr_t   *   *  Description:   *      Thread attribute.   *      typedef to pthread_attr_t   *      Internal Use Only   ***************************************************************************/  typedef pthread_attr_t ithread_attr_t;	  /****************************************************************************   * Name: start_routine   *   *  Description:   *      Thread start routine    *      Internal Use Only.   ***************************************************************************/  typedef void * (*start_routine) (void *arg);    /****************************************************************************   * Name: ithread_cond_t   *   *  Description:   *      condition variable.   *      typedef to pthread_cond_t   *      Internal Use Only.   ***************************************************************************/  typedef pthread_cond_t ithread_cond_t;  /****************************************************************************   * Name: ithread_mutexattr_t   *   *  Description:   *      Mutex attribute.   *      typedef to pthread_mutexattr_t   *      Internal Use Only   ***************************************************************************/  typedef pthread_mutexattr_t ithread_mutexattr_t;	  /****************************************************************************   * Name: ithread_mutex_t   *   *  Description:   *      Mutex.   *      typedef to pthread_mutex_t   *      Internal Use Only.   ***************************************************************************/  typedef pthread_mutex_t ithread_mutex_t;  /****************************************************************************   * Name: ithread_condattr_t   *   *  Description:   *      Condition attribute.   *      typedef to pthread_condattr_t   *      NOT USED   *      Internal Use Only   ***************************************************************************/  typedef pthread_condattr_t ithread_condattr_t;	  /****************************************************************************   * Function: ithread_mutexattr_init   *   *  Description:   *      Initializes a mutex attribute variable.   *      Used to set the type of the mutex.   *  Parameters:   *      ithread_mutexattr_init * attr (must be valid non NULL pointer to    *                                     pthread_mutexattr_t)   *  Returns:   *      0 on success, Nonzero on failure.   *      Always returns 0.   *      See man page for pthread_mutexattr_init   ***************************************************************************/  #define ithread_mutexattr_init pthread_mutexattr_init    /****************************************************************************   * Function: ithread_mutexattr_destroy   *   *  Description:   *      Releases any resources held by the mutex attribute.   *      Currently there are no resources associated with the attribute   *  Parameters:   *      ithread_mutexattr_t * attr (must be valid non NULL pointer to    *                                  pthread_mutexattr_t)   *  Returns:   *      0 on success, Nonzero on failure.   *      Always returns 0.   *      See man page for pthread_mutexattr_destroy   ***************************************************************************/#define ithread_mutexattr_destroy pthread_mutexattr_destroy    /**************************************************************************** * Function: ithread_mutexattr_setkind_np * *  Description: *      Sets the mutex type in the attribute. *      Valid types are: ITHREAD_MUTEX_FAST_NP  *                       ITHREAD_MUTEX_RECURSIVE_NP  *                       ITHREAD_MUTEX_ERRORCHECK_NP * *  Parameters: *      ithread_mutexattr_t * mutex (must be valid non NULL pointer to  *                                   ithread_mutexattr_t) *      int kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP *                or ITHREAD_MUTEX_ERRORCHECK_NP) *  Returns: *      0 on success. Nonzero on failure. *      Returns EINVAL if the kind is not supported. *      See man page for pthread_mutexattr_setkind_np *****************************************************************************/#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np/**************************************************************************** * Function: ithread_mutexattr_getkind_np * *  Description: *      Gets the mutex type in the attribute. *      Valid types are: ITHREAD_MUTEX_FAST_NP  *                       ITHREAD_MUTEX_RECURSIVE_NP  *                       ITHREAD_MUTEX_ERRORCHECK_NP * *  Parameters: *      ithread_mutexattr_t * mutex (must be valid non NULL pointer to  *                                   pthread_mutexattr_t) *      int *kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP *                or ITHREAD_MUTEX_ERRORCHECK_NP) *  Returns: *      0 on success. Nonzero on failure. *      Always returns 0. *      See man page for pthread_mutexattr_getkind_np *****************************************************************************/#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np  /**************************************************************************** * Function: ithread_mutex_init * *  Description: *      Initializes mutex. *      Must be called before use. *       *  Parameters: *      ithread_mutex_t * mutex (must be valid non NULL pointer to pthread_mutex_t) *      const ithread_mutexattr_t * mutex_attr  *  Returns: *      0 on success, Nonzero on failure. *      Always returns 0. *      See man page for pthread_mutex_init *****************************************************************************/#define ithread_mutex_init pthread_mutex_init  /**************************************************************************** * Function: ithread_mutex_lock * *  Description: *      Locks mutex. *  Parameters: *      ithread_mutex_t * mutex (must be valid non NULL pointer to pthread_mutex_t) *      mutex must be initialized. *       *  Returns: *      0 on success, Nonzero on failure. *      Always returns 0. *      See man page for pthread_mutex_lock *****************************************************************************/#define ithread_mutex_lock pthread_mutex_lock  /**************************************************************************** * Function: ithread_mutex_unlock * *  Description: *      Unlocks mutex. * *  Parameters: *      ithread_mutex_t * mutex (must be valid non NULL pointer to pthread_mutex_t) *      mutex must be initialized. *       *  Returns: *      0 on success, Nonzero on failure. *      Always returns 0. *      See man page for pthread_mutex_unlock *****************************************************************************/#define ithread_mutex_unlock pthread_mutex_unlock/**************************************************************************** * Function: ithread_mutex_destroy * *  Description: *      Releases any resources held by the mutex.  *		Mutex can no longer be used after this call. *		Mutex is only destroyed when there are no longer any threads waiting on it.  *		Mutex cannot be destroyed if it is locked. *  Parameters: *      ithread_mutex_t * mutex (must be valid non NULL pointer to pthread_mutex_t) *      mutex must be initialized.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -