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

📄 osip_mt.h

📁 SIP协议栈实现
💻 H
字号:
/*  The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)  Copyright (C) 2001  Aymeric MOIZARD jack@atosc.org    This library is free software; you can redistribute it and/or  modify it under the terms of the GNU Lesser General Public  License as published by the Free Software Foundation; either  version 2.1 of the License, or (at your option) any later version.    This library is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public  License along with this library; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#ifndef _OSIP_MT_H_#define _OSIP_MT_H_#ifdef OSIP_MT#ifdef ENABLE_MPATROL#include <mpatrol.h>#endif#include <stdio.h>#include <errno.h>/** * @file osip_mt.h * @brief oSIP Thread, Mutex and Semaphore definitions * * Those methods are only available if the library is compile * in multi threaded mode. This is the default for oSIP. *//** * @defgroup oSIP_THREAD oSIP Thread Routines * @ingroup oSIP * @{ */#ifdef __cplusplusextern "C"{#endif/** * Structure for referencing a thread * @var osip_thread_t */  struct osip_thread;/** * Allocate (or initialise if a thread address is given) * @param stacksize The stack size of the thread. (20000 is a good value) * @param func The method where the thread start. * @param arg A pointer on the argument given to the method 'func'. */  struct osip_thread *osip_thread_create (int stacksize, void *(*func) (void *), void *arg);/** * Join a thread. * @param thread The thread to join. */  int osip_thread_join (struct osip_thread * thread);/** * Set the priority of a thread. (NOT IMPLEMENTED ON ALL SYSTEMS) * @param thread The thread to work on. * @param priority The priority value to set. */  int osip_thread_set_priority (struct osip_thread * thread, int priority);/** * Exit from a thread. */  void osip_thread_exit ();#ifdef __cplusplus}#endif/** @} *//** * @defgroup oSIP_SEMA oSIP semaphore definitions * @ingroup oSIP * @{ */#ifdef __cplusplusextern "C"{#endif/** * Structure for referencing a semaphore element. * @defvar struct osip_sem */  struct osip_sem;/** * Allocate and Initialise a semaphore. * @param value The initial value for the semaphore. */  struct osip_sem *osip_sem_init (unsigned int value);/** * Destroy a semaphore. * @param sem The semaphore to destroy. */  int osip_sem_destroy (struct osip_sem * sem);/** * Post operation on a semaphore. * @param sem The semaphore to destroy. */  int osip_sem_post (struct osip_sem * sem);/** * Wait operation on a semaphore. * NOTE: this call will block if the semaphore is at 0. * @param sem The semaphore to destroy. */  int osip_sem_wait (struct osip_sem * sem);/** * Wait operation on a semaphore. * NOTE: if the semaphore is at 0, this call won't block. * @param sem The semaphore to destroy. */  int osip_sem_trywait (struct osip_sem * sem);#ifdef __cplusplus}#endif/** @} *//** * @defgroup oSIP_MUTEX oSIP semaphore definitions * @ingroup oSIP * @{ */#ifdef __cplusplusextern "C"{#endif/** * Structure for referencing a semaphore element. * @defvar struct osip_mutex */  struct osip_mutex;/** * Allocate and Initialise a semaphore. */  struct osip_mutex *osip_mutex_init ();/** * Destroy the mutex. * @param mut The mutex to destroy. */  void osip_mutex_destroy (struct osip_mutex * mut);/** * Lock the mutex. * @param mut The mutex to lock. */  int osip_mutex_lock (struct osip_mutex * mut);/** * Unlock the mutex. * @param mut The mutex to unlock. */  int osip_mutex_unlock (struct osip_mutex * mut);#ifdef __cplusplus}#endif/** @} */#endif				/* OSIP_MT */#endif				/* end of _THREAD_H_ */

⌨️ 快捷键说明

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