mailbox.cc

来自「VRTX 商用嵌入式实时操作系统」· CC 代码 · 共 57 行

CC
57
字号
/***************************************************************************
*
*		Copyright (c) 1993 READY SYSTEMS CORPORATION.
*
*	All rights reserved. READY SYSTEMS' source code is an unpublished
*	work and the use of a copyright notice does not imply otherwise.
*	This source code contains confidential, trade secret material of
*	READY SYSTEMS. Any attempt or participation in deciphering, decoding,
*	reverse engineering or in any way altering the source code is
*	strictly prohibited, unless the prior written consent of
*	READY SYSTEMS is obtained.
*
*
*	Module Name:		mailbox.cc
*
*	Identification:		@(#) 1.3 mailbox.cc
*
*	Date:			4/26/93  17:15:25
*
****************************************************************************
*/

#include "mailbox.h"

Mailbox::Mailbox ()
{
  mbox = 0;
}

Mailbox::~Mailbox ()
{
}

int
Mailbox::receive (void *&message, unsigned long timeout)
{
  int err;
  message = sc_pend(&mbox, timeout, &err);
  return err == RET_OK;
}

int
Mailbox::send (void *message)
{
  int err;
  sc_post(&mbox, (char *) message, &err);
  return err == RET_OK;
}

int
Mailbox::accept (void *&message)
{
  int err;
  message = sc_accept(&mbox, &err);
  return err == RET_OK;
}

⌨️ 快捷键说明

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