TCP-IP红宝书源代码

源代码在线查看: mark.c

软件大小: 1091 K
上传用户: gdmichael
关键词: TCP-IP 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* mark.c - _mkinit, mark */
				
				#include 
				#include 
				#include 
				
				
				#ifdef	MEMMARK
				int	*marks[MAXMARK];
				int	nmarks;
				int	mkmutex;
				
				/*------------------------------------------------------------------------
				 *  _mkinit  --  called once at system startup
				 *------------------------------------------------------------------------
				 */
				_mkinit()
				{
					mkmutex = screate(1);
					nmarks = 0;
				}
				
				
				
				/*------------------------------------------------------------------------
				 *  mark  --  mark a location if it hasn't been marked
				 *------------------------------------------------------------------------
				 */
				mark(loc)
				int *loc;
				{
				
					if ( *loc>=0 && *loc						return(0);
					if (nmarks>=MAXMARK)
						return(SYSERR);
					wait(mkmutex);
					marks[ (*loc) = nmarks++] = loc;
					signal(mkmutex);
					return(OK);
				}
				#endif
							

相关资源