📄 semaphore.h
字号:
/******************************************************************************
*******************************************************************************
** **
** Copyright (c) 2006 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
*******************************************************************************
******************************************************************************/
/**
* @file semaphore.h
*
* $Revision: 1.3 $
*
* Wraps the osapi binary and counting semaphores as a referenced object
* Binary Semaphores are slightly different in functionally from the base
* implementation in osapi - it does not consider signaling an already
* signaled semaphore an error.
*/
#ifndef __SEMAPHORE_H
#define __SEMAPHORE_H
#include "reference_counter.h"
#include "vcitypes.h"
#include "osapi.h"
class Semaphore : public ReferenceCounter
{
protected:
OS_SEM_ID semaphoreHandle;
virtual VDVD_ERROR Construct ( void )=0;
VDVD_ERROR Destruct ( void );
public:
Semaphore ( void );
VDVD_ERROR Create ( void );
VDVD_ERROR Destroy ( void );
VDVD_ERROR Wait ( void );
VDVD_ERROR Wait ( uint32 timeoutInMilliseconds );
VDVD_ERROR Signal ( void );
};
class BinarySemaphore : public Semaphore
{
private:
VDVD_ERROR Construct ( void );
};
class CountingSemaphore : public Semaphore
{
private:
VDVD_ERROR Construct ( void );
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -