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

📄 tcmgr.h

📁 T-kernel 的extension源代码
💻 H
字号:
/* *---------------------------------------------------------------------- *    T-Kernel / Standard Extension * *    Copyright (C) 2006 by Ken Sakamura. All rights reserved. *    T-Kernel / Standard Extension is distributed  *      under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* *	tcmgr.h (taskcomm) * *	Inter-task synchronous communication management */#define	DEBUG_MODULE	"(taskcomm)"#include <basic.h>#include <tk/tkernel.h>#include <tk/util.h>#include <extension/tkcall.h>#include <extension/errno.h>#include <sys/util.h>#include <libstr.h>#include <sys/debug.h>#include <extension/sys/svc/iftkcall.h>#if VIRTUAL_ADDRESS#include <alloca.h>#endif/* * Object ID */typedef enum {	O_SEM	= (INT)0x00010000,	/* Semaphore (synchronization semaphore) */	O_FLG	= (INT)0x00020000,	/* Event flag */	O_MBF	= (INT)0x00030000,	/* Message buffer */	O_POR	= (INT)0x00040000,	/* Rendezvous port */	O_MTX	= (INT)0x00050000,	/* Mutex (exclusive control semaphore) */	O_MBX   = (INT)0x00060000,	/* Message Box */	O_Mask	= (INT)0xffff0000,	/* Object type mask */	I_Mask	= (INT)0x0000ffff	/* Object ID mask */} ObjectType;#define	toBID(type, id)		(ID)((type) | (id))#define	toIID(bid)		(ID)((bid) & (I_Mask))/* * Process-related information */typedef struct {	VP	tcobj;		/* Inter-task synchronous communication object */} TCINFO;#define	GetTCinfo(tid)		( (TCINFO*)GetMinfo(tid, TCM_SVC) )/* * Exclusive control lock in manager */IMPORT FastLock	tcmLock;#define	LockTCM()	Lock(&tcmLock)#define	UnlockTCM()	Unlock(&tcmLock)#define	LOCK_TCM(exp)	{ LockTCM(); { exp; } UnlockTCM(); }/* * And all the rest */#define	max(a,b)	(( (a) > (b) )? (a): (b))#define	min(a,b)	(( (a) < (b) )? (a): (b))#define	xchg(t,a,b)	{ t _tmp; _tmp = (a); (a) = (b); (b) = _tmp; }/* ------------------------------------------------------------------------ */#define	IMPORT_DEFINE	1#if IMPORT_DEFINE/* main.c */IMPORT FastLock tcmLock;IMPORT ER       tcmTkCheckID( ObjectType type, ID id );IMPORT ER       tcmTkCheckBuffSize( W sz );IMPORT ER       tcmTkRegistObject( ID id );IMPORT ER       tcmTkDeleteObject( ID id, TCINFO *tcinfo );IMPORT ER       tcmTkSearchObject( ID id, TCINFO *tcinfo );IMPORT ER       TaskCommMgr( INT ac, UB *av[] );/* tksem.c */IMPORT ID _tkse_cre_sem( T_CSEM *pk_csem );IMPORT ER _tkse_del_sem( ID id );IMPORT ER _tkse_sig_sem( ID id, INT cnt );IMPORT ER _tkse_wai_sem( ID id, INT cnt, TMO tmout );IMPORT ER _tkse_ref_sem( ID id, T_RSEM *pk_rsem );/* tkmtx.c */IMPORT ID _tkse_cre_mtx( T_CMTX *pk_cmtx );IMPORT ER _tkse_del_mtx( ID id );IMPORT ER _tkse_loc_mtx( ID id, TMO tmout );IMPORT ER _tkse_unl_mtx( ID id );IMPORT ER _tkse_ref_mtx( ID id, T_RMTX *pk_rmtx );/* tkflg.c */IMPORT ID _tkse_cre_flg( T_CFLG *pk_cflg );IMPORT ER _tkse_del_flg( ID id );IMPORT ER _tkse_set_flg( ID id, UINT setptn );IMPORT ER _tkse_clr_flg( ID id, UINT clrptn );IMPORT ER _tkse_wai_flg( ID id, UINT waiptn, UINT wfmode, UINT *p_flgptn, TMO tmout );IMPORT ER _tkse_ref_flg( ID id, T_RFLG *pk_rflg );/* tkmbf.c */IMPORT ID  _tkse_cre_mbf( T_CMBF *pk_cmbf );IMPORT ER  _tkse_del_mbf( ID id );IMPORT ER  _tkse_snd_mbf( ID id, VP msg, INT sz, TMO tmout );IMPORT INT _tkse_rcv_mbf( ID id, VP msg, TMO tmout );IMPORT ER  _tkse_ref_mbf( ID id, T_RMBF *pk_rmbf );/* tkpor.c */IMPORT ID  _tkse_cre_por( T_CPOR *pk_cpor );IMPORT ER  _tkse_del_por( ID id );IMPORT INT _tkse_cal_por( ID id, UINT calptn, VP msg, INT cmsz, TMO tmout );IMPORT INT _tkse_acp_por( ID id, UINT acpptn, RNO *p_rdvno, VP msg, TMO tmout );IMPORT ER  _tkse_fwd_por( ID id, UINT calptn, RNO rdvno, VP msg, INT cmsz );IMPORT ER  _tkse_rpl_rdv( RNO rdvno, VP msg, INT rmsz );IMPORT ER  _tkse_ref_por( ID id, T_RPOR *pk_rpor );/* tkmbx.c */IMPORT ID  _tkse_cre_mbx( T_CMBX *pk_cmbx );IMPORT ER  _tkse_del_mbx( ID id );IMPORT ER  _tkse_snd_mbx( ID id, T_MSG *msg );IMPORT INT _tkse_rcv_mbx( ID id, T_MSG **msg, TMO tmout );IMPORT ER  _tkse_ref_mbx( ID id, T_RMBX *pk_rmbx );#endif

⌨️ 快捷键说明

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