📄 mbox.cxx
字号:
//==========================================================================//// mbox.cxx//// Mbox mbox template class implementation////==========================================================================//####COPYRIGHTBEGIN####// // ------------------------------------------- // The contents of this file are subject to the Red Hat eCos Public License // Version 1.1 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // http://www.redhat.com/ // // Software distributed under the License is distributed on an "AS IS" // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the // License for the specific language governing rights and limitations under // the License. // // The Original Code is eCos - Embedded Configurable Operating System, // released September 30, 1998. // // The Initial Developer of the Original Code is Red Hat. // Portions created by Red Hat are // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. // All Rights Reserved. // ------------------------------------------- // //####COPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s): hmt// Contributors: hmt// Date: 1998-02-11// Purpose: Mbox implementation// Description: This file contains the implementations of the mbox class////####DESCRIPTIONEND####////==========================================================================#include <pkgconf/kernel.h>#include <cyg/kernel/ktypes.h> // base kernel types#include <cyg/infra/cyg_trac.h> // tracing macros#include <cyg/infra/cyg_ass.h> // assertion macros#include <cyg/kernel/instrmnt.h> // instrumentation#include <cyg/kernel/thread.inl> // Cyg_Thread inlines#include <cyg/kernel/mbox.hxx> // our own header#ifndef CYGIMP_MBOXT_INLINE // force inlining#define CYGIMP_MBOXT_INLINE // of implementation#endif#ifdef CYGIMP_MBOX_USE_MBOXT_PLAIN#include <cyg/kernel/mboxt.inl> // mbox template implementation#else#include <cyg/kernel/mboxt2.inl> // mbox template implementation#endif// -------------------------------------------------------------------------// This module exists to cause exactly one instance of these functions to// exist; this is just like a vanilla class, except we use the template// class to acquire an implementation. The template functions are inlined// in each of these methods.// -------------------------------------------------------------------------// ConstructorCyg_Mbox::Cyg_Mbox(){}// -------------------------------------------------------------------------// DestructorCyg_Mbox::~Cyg_Mbox(){}// -------------------------------------------------------------------------// debugging/assert function#ifdef CYGDBG_USE_ASSERTScyg_bool Cyg_Mbox::check_this(cyg_assert_class_zeal zeal) const{ return m.check_this(zeal);}#endif// -------------------------------------------------------------------------// now the members themselves: void *Cyg_Mbox::get(){ void * p; if ( ! m.get( p ) ) return NULL; return p;}#ifdef CYGFUN_KERNEL_THREADS_TIMERvoid *Cyg_Mbox::get( cyg_tick_count timeout ){ void * p; if ( ! m.get( p, timeout ) ) return NULL; return p;}#endifvoid *Cyg_Mbox::tryget(){ void * p; if ( ! m.tryget( p ) ) return NULL; return p;}#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAITcyg_boolCyg_Mbox::put( void *item ){ return m.put( item );}#ifdef CYGFUN_KERNEL_THREADS_TIMERcyg_boolCyg_Mbox::put( void *item, cyg_tick_count timeout ){ return m.put( item, timeout );}#endif#endif // CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAITcyg_boolCyg_Mbox::tryput( void *item ){ return m.tryput( item );}void *Cyg_Mbox::peek_item() // Get next item to be returned{ void *p; if ( ! m.peek_item( p ) ) return NULL; return p;}// -------------------------------------------------------------------------// EOF mbox.cxx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -