rvqueue.h

来自「h.248协议源码」· C头文件 代码 · 共 72 行

H
72
字号
#if (0)
******************************************************************************
Filename:
Description:
******************************************************************************
                Copyright (c) 1999 RADVision Inc.
************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever 
without written prior approval by RADVision LTD..

RADVision LTD. reserves the right to revise this publication and make 
changes without obligation to notify any person of such revisions or 
changes.
******************************************************************************
$Revision:$
$Date:$
$Author:$
******************************************************************************
#endif

#ifndef RV_QUEUE_H
#define RV_QUEUE_H

#include <stddef.h>
#include "rvtypes.h"
#include "rvmon_.h"
#include "rvcond_.h"

/******************************************************************* 
Note: rvQueueStop() causes all threads pending in the queue and all
subsequent calls to rvQueuePush() and rvQueuePop() to return with 
an error indicating the queue has been stopped.  The thread should 
not access the queue after this indication has been returned.
********************************************************************/

typedef void* RvQueueType;

typedef struct {
	RvMon_ mon;
	RvCond_ cond;
	RvQueueType* data;
	int done; 
	size_t first;
	size_t last;
	size_t emptyCount;
	size_t fullCount;
	size_t n;
} RvQueue;

#if defined(__cplusplus)
extern "C" {
#endif


RvQueue* rvQueueConstruct(RvQueue* q, size_t n);
void rvQueueDestruct(RvQueue* q);
#define rvQueueEmpty(q)			(rvQueueSize(q) == 0)
#define rvQueueFull(q)			(rvQueueSize(q) == (q)->n)
size_t rvQueueSize(RvQueue* q);
int rvQueuePush(RvQueue* q, RvQueueType m);
int rvQueuePop(RvQueue* q, OUT RvQueueType* m);
void rvQueueStop(RvQueue* q);

#if defined(__cplusplus)
}
#endif

#endif

⌨️ 快捷键说明

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