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

📄 sem.h

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 H
字号:
/*
 * sem.h,v 1.3 2000/06/04 22:00:03 brunsch Exp
 *
 * Copyright (c) 1994, 1995.  Netscape Communications Corporation.  All
 * rights reserved.
 *
 * Use of this software is governed by the terms of the license agreement for
 * the Netscape Communications or Netscape Comemrce Server between the
 * parties.
 */


/* ------------------------------------------------------------------------ */


/*
 * sem.h: Attempt to provide multi-process semaphores across platforms
 *
 * Rob McCool
 */


#ifndef SEM_H
#define SEM_H

#include "systems.h"


/* All of the implementations currently use int as the semaphore type */
#ifdef SEM_WIN32
typedef HANDLE SEMAPHORE;
#define SEM_ERROR NULL
/* That oughta hold them (I hope) */
#define SEM_MAXVALUE 32767

#else /* ! SEM_WIN32 */
typedef int SEMAPHORE;
#define SEM_ERROR -1
#endif /* SEM_WIN32 */

/*
 * sem_init creates a semaphore using the given name and unique
 * identification number. filename should be a file accessible to the
 * process. Returns SEM_ERROR on error.
 */

SEMAPHORE sem_init(char *name, int number);

/*
 * sem_terminate de-allocates the given semaphore.
 */

void sem_terminate(SEMAPHORE id);

/*
 * sem_grab attempts to gain exclusive access to the given semaphore. If
 * it can't get it, the caller will block. Returns -1 on error.
 */

int sem_grab(SEMAPHORE id);

/*
 * sem_release releases this process's exclusive control over the given
 * semaphore. Returns -1 on error.
 */

int sem_release(SEMAPHORE id);


#endif

⌨️ 快捷键说明

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