亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mboxt2.inl

?? ecos下的gui開發(fā)源代碼
?? INL
?? 第 1 頁 / 共 2 頁
字號:
#ifndef CYGONCE_KERNEL_MBOXT2_INL
#define CYGONCE_KERNEL_MBOXT2_INL
//==========================================================================
//
//      mboxt2.inl
//
//      Mboxt2 mbox template class implementation
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
// Copyright (C) 2006 eCosCentric Ltd.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):   hmt
// Contributors:        hmt
// Date:        1998-02-10
// Purpose:     Mboxt2 template implementation
// Description: This file contains the implementations of the mboxt2
//              template classes.
//
//####DESCRIPTIONEND####
//
//==========================================================================

#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/mboxt2.hxx>       // our header

#include <cyg/kernel/thread.inl>       // thread inlines
#include <cyg/kernel/sched.inl>        // scheduler inlines
#include <cyg/kernel/clock.inl>        // clock inlines

// -------------------------------------------------------------------------
// inline function for awakening waiting threads

template <class T, cyg_count32 QUEUE_SIZE>
inline void
Cyg_Mboxt2<T,QUEUE_SIZE>::wakeup_winner( const T &msg )
{
    CYG_ASSERT( !get_threadq.empty(), "Where did the winner go?" );

    // The queue is non-empty, so grab the next thread and wake it up.
    Cyg_Thread *thread = get_threadq.dequeue();

    CYG_ASSERTCLASS( thread, "Bad thread pointer");

    T *msg_ret = (T *)(thread->get_wait_info());
    *msg_ret = msg;

    thread->set_wake_reason( Cyg_Thread::DONE );
    thread->wake();
        
    CYG_INSTRUMENT_MBOXT(WAKE, this, thread);        
}

#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
template <class T, cyg_count32 QUEUE_SIZE>
inline void
Cyg_Mboxt2<T,QUEUE_SIZE>::wakeup_putter( void )
{
    if( !put_threadq.empty() ) {
        // The queue is non-empty, so grab the next thread and wake it up.
        Cyg_Thread *thread = put_threadq.dequeue();

        CYG_ASSERTCLASS( thread, "Bad thread pointer");

        T *new_msg = (T *)(thread->get_wait_info());

        cyg_count32 in = base + (count++);
        if ( size <= in )
            in -= size;

        CYG_ASSERT( size > in, "in overflow" );
        CYG_ASSERT( 0 <= in, "in overflow" );
        CYG_ASSERT( size >= count, "count overflow" );

        itemqueue[ in ] = *new_msg;

        thread->set_wake_reason( Cyg_Thread::DONE );
        thread->wake();
        
        CYG_INSTRUMENT_MBOXT(WAKE, this, thread);        
    }
}
#endif

// -------------------------------------------------------------------------
// Constructor

template <class T, cyg_count32 QUEUE_SIZE>
Cyg_Mboxt2<T,QUEUE_SIZE>::Cyg_Mboxt2()
{
    CYG_REPORT_FUNCTION();
    base = 0;
    count = 0;
    CYG_REPORT_RETURN();
}

// -------------------------------------------------------------------------
// Destructor

template <class T, cyg_count32 QUEUE_SIZE>
Cyg_Mboxt2<T,QUEUE_SIZE>::~Cyg_Mboxt2()
{
    CYG_REPORT_FUNCTION();
#if 0
    CYG_ASSERT( 0 == count, "Deleting mboxt2 with messages");
    CYG_ASSERT( get_threadq.empty(), "Deleting mboxt2 with threads waiting to get");
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
    CYG_ASSERT( put_threadq.empty(), "Deleting mboxt2 with threads waiting to put");
#endif
#endif
    // Prevent preemption
    Cyg_Scheduler::lock();

    while ( ! get_threadq.empty() ) {
        Cyg_Thread *thread = get_threadq.dequeue();
        thread->set_wake_reason( Cyg_Thread::DESTRUCT );
        thread->wake();
    }
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
    while ( ! put_threadq.empty() ) {
        Cyg_Thread *thread = put_threadq.dequeue();
        thread->set_wake_reason( Cyg_Thread::DESTRUCT );
        thread->wake();
    }
#endif

    // Unlock the scheduler and maybe switch threads
    Cyg_Scheduler::unlock();    
    CYG_REPORT_RETURN();
}

// -------------------------------------------------------------------------
// debugging/assert function

#ifdef CYGDBG_USE_ASSERTS

template <class T, cyg_count32 QUEUE_SIZE>
cyg_bool 
Cyg_Mboxt2<T,QUEUE_SIZE>::check_this(cyg_assert_class_zeal zeal) const
{
    if ( Cyg_Thread::DESTRUCT == Cyg_Thread::self()->get_wake_reason() )
        // then the whole thing is invalid, and we know it.
        // so return OK, since this check should NOT make an error.
        return true;

    // check that we have a non-NULL pointer first
    if( this == NULL ) return false;

#if 0 // thread queues do not have checking funcs.
    if ( ! get_threadq.check_this( zeal ) ) return false;
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
    if ( ! put_threadq.check_this( zeal ) ) return false;
#endif
#endif

    switch( zeal )
    {
    case cyg_system_test:
    case cyg_extreme:
    case cyg_thorough:
    case cyg_quick:
    case cyg_trivial:
        // plenty of scope for fencepost problems here
        if ( size < count ) return false;
        if ( size <= base ) return false;
        if ( 0 > count ) return false;
        if ( 0 > base  ) return false;

        // Comments about needing 2 queues elided; they're not true in this
        // immediate-dispatch model.  I think we could get away with only
        // one queue now, biut is it worth it?  4 bytes of redundant info
        // buys a lot of correctness.
      
    case cyg_none:
    default:
        break;
    };

    return true;
}

#endif


// -------------------------------------------------------------------------
// From here downwards, these are the major functions of the template; if
// being genuinely used as a template they should probably not be inlined.
// If being used to construct a specific class, with explicit functions,
// then they should be.  This is controlled by:

#ifdef CYGIMP_MBOXT_INLINE
#define CYG_MBOXT_INLINE inline
#else
#define CYG_MBOXT_INLINE
#endif

// -------------------------------------------------------------------------
// Get an item, or wait for one to arrive

template <class T, cyg_count32 QUEUE_SIZE>
CYG_MBOXT_INLINE cyg_bool
Cyg_Mboxt2<T,QUEUE_SIZE>::get( T &ritem )
{
    CYG_REPORT_FUNCTION();
    Cyg_Thread *self = Cyg_Thread::self();
    
    // Prevent preemption
    Cyg_Scheduler::lock();

    CYG_ASSERTCLASS( this, "Bad this pointer");
    
    CYG_INSTRUMENT_MBOXT(GET, this, count);

    if ( 0 < count ) {
        CYG_INSTRUMENT_MBOXT(GOT, this, count);
    
        ritem = itemqueue[ (count--, base++) ];
        CYG_ASSERT( 0 <= count, "Count went -ve" );
        CYG_ASSERT( size >= base, "Base overflow" );

        if ( size <= base )
            base = 0;

#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
        wakeup_putter();
#endif

        CYG_ASSERTCLASS( this, "Bad this pointer");

        // Unlock the scheduler and definitely switch threads
        Cyg_Scheduler::unlock();

        CYG_REPORT_RETVAL( true );
        return true;
    }

    self->set_wait_info( (CYG_ADDRWORD)&ritem );
    self->set_sleep_reason( Cyg_Thread::WAIT );
    self->sleep();
    get_threadq.enqueue( self );

    CYG_INSTRUMENT_MBOXT(WAIT, this, count);

    CYG_ASSERTCLASS( this, "Bad this pointer");

    // Unlock scheduler and allow other threads to run
    Cyg_Scheduler::unlock_reschedule();

    cyg_bool result = true;
    switch( self->get_wake_reason() )
    {
    case Cyg_Thread::DESTRUCT:
    case Cyg_Thread::BREAK:
        result = false;
        break;
            
    case Cyg_Thread::EXIT:            
        self->exit();
        break;

    default:
        break;
    }

    CYG_REPORT_RETVAL( result );
    return result;
}


// -------------------------------------------------------------------------
// Try to get an item with an absolute timeout and return success.

#ifdef CYGFUN_KERNEL_THREADS_TIMER
template <class T, cyg_count32 QUEUE_SIZE>
CYG_MBOXT_INLINE cyg_bool
Cyg_Mboxt2<T,QUEUE_SIZE>::get( T &ritem, cyg_tick_count abs_timeout )
{
    CYG_REPORT_FUNCTION();
        
    Cyg_Thread *self = Cyg_Thread::self();
    
    // Prevent preemption
    Cyg_Scheduler::lock();

    CYG_ASSERTCLASS( this, "Bad this pointer");
    
    CYG_INSTRUMENT_MBOXT(GET, this, count);

    if ( 0 < count ) {
        CYG_INSTRUMENT_MBOXT(GOT, this, count);
    
        ritem = itemqueue[ (count--, base++) ];
        CYG_ASSERT( 0 <= count, "Count went -ve" );
        CYG_ASSERT( size >= base, "Base overflow" );

        if ( size <= base )
            base = 0;

#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
        wakeup_putter();
#endif

        CYG_ASSERTCLASS( this, "Bad this pointer");

        // Unlock the scheduler and maybe switch threads
        Cyg_Scheduler::unlock();

        CYG_REPORT_RETVAL( true );
        return true;
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美xfplay| 自拍av一区二区三区| 成人的网站免费观看| 亚洲国产精品欧美一二99| 国产亚洲人成网站| 在线成人免费视频| 91在线观看免费视频| 国产麻豆一精品一av一免费| 一区二区三区四区五区视频在线观看| 日韩一区二区麻豆国产| 色综合咪咪久久| 国产乱子伦视频一区二区三区| 性欧美大战久久久久久久久| 国产精品―色哟哟| 精品国产a毛片| 欧美日韩www| 色屁屁一区二区| 高清日韩电视剧大全免费| 伦理电影国产精品| 亚洲成人三级小说| 亚洲激情网站免费观看| 国产精品不卡在线| 久久噜噜亚洲综合| 精品嫩草影院久久| 日韩亚洲欧美成人一区| 欧美三级中文字幕| 91极品美女在线| 99久久精品国产导航| 成人高清视频在线| 国产91富婆露脸刺激对白| 美国欧美日韩国产在线播放| 五月天激情综合网| 亚洲高清免费观看| 亚洲韩国一区二区三区| 亚洲在线视频一区| 一区二区在线免费观看| 亚洲同性gay激情无套| 国产精品久久久久精k8| 中文字幕的久久| 欧美国产日韩一二三区| 欧美国产日韩亚洲一区| 中文字幕av不卡| 国产精品久久久一本精品| 欧美激情综合在线| 中文一区在线播放| 亚洲欧美在线视频| 乱一区二区av| 国产美女一区二区三区| 国产高清精品在线| 成人精品鲁一区一区二区| 成人综合婷婷国产精品久久| 国产精品69毛片高清亚洲| 风流少妇一区二区| av一二三不卡影片| 欧美亚洲国产怡红院影院| 欧美四级电影在线观看| 欧美美女直播网站| 欧美成人精品1314www| 精品国产91亚洲一区二区三区婷婷| 精品久久国产97色综合| 久久久综合精品| 国产精品久久久久久久久久免费看| 亚洲日本免费电影| 青娱乐精品视频在线| 狠狠色狠狠色综合| va亚洲va日韩不卡在线观看| 91久久精品一区二区三区| 91精品蜜臀在线一区尤物| 精品久久免费看| 中文字幕日韩一区| 亚洲123区在线观看| 九色|91porny| 99久久精品99国产精品| 欧美日韩色综合| 精品国产3级a| 亚洲激情网站免费观看| 久久不见久久见免费视频7| 成人性生交大片免费看视频在线| 91视频国产资源| 日韩一区二区三区三四区视频在线观看| 久久综合久久久久88| 亚洲免费视频成人| 久热成人在线视频| 99精品黄色片免费大全| 91精品国产乱| 国产精品电影一区二区| 日韩成人一区二区| 波多野结衣中文字幕一区二区三区 | 日韩欧美一级精品久久| 国产精品嫩草99a| 日韩avvvv在线播放| 成人免费av资源| 亚洲影院久久精品| 国产成人免费视频网站| 欧美久久婷婷综合色| 国产三级一区二区| 日韩精品五月天| 99久久er热在这里只有精品15| 91精品在线麻豆| 亚洲视频你懂的| 国产成人av自拍| 日韩亚洲欧美在线| 亚洲成人一二三| 91视频免费播放| 国产欧美一二三区| 久久精品72免费观看| 欧美视频在线播放| 中文字幕一区在线观看| 国产一区二区福利视频| 欧美精品免费视频| 夜夜精品视频一区二区| 成人免费毛片app| 26uuu国产一区二区三区| 日韩综合在线视频| 色欧美日韩亚洲| 亚洲天堂av老司机| www.欧美.com| 国产欧美日韩精品在线| 麻豆精品久久久| 5566中文字幕一区二区电影| 一区二区三区不卡视频 | 老司机午夜精品99久久| 欧美专区日韩专区| 亚洲精品视频在线| 91免费在线视频观看| 国产精品灌醉下药二区| 久久久www免费人成精品| 五月婷婷另类国产| 欧美午夜精品久久久久久孕妇| 成人欧美一区二区三区小说| 粗大黑人巨茎大战欧美成人| 久久久久久久久久久久久女国产乱| 六月丁香婷婷久久| 日韩欧美国产一区在线观看| 青青草国产成人99久久| 日韩亚洲电影在线| 日产国产高清一区二区三区| 欧美精品黑人性xxxx| 日韩高清一区在线| 欧美一区二视频| 美女视频黄 久久| 精品三级av在线| 国产一区二区视频在线播放| 久久免费的精品国产v∧| 国产高清不卡一区| 欧美经典一区二区| 99久久婷婷国产精品综合| 亚洲欧洲av色图| 色妹子一区二区| 亚洲高清免费一级二级三级| 欧美高清视频www夜色资源网| 日韩精品亚洲一区| 久久一区二区三区国产精品| 国产成人精品午夜视频免费| 国产精品传媒视频| 91麻豆swag| 日日欢夜夜爽一区| 久久综合久久99| 99久久久久久| 天天做天天摸天天爽国产一区| 欧美一区二区三区播放老司机| 蜜桃在线一区二区三区| 国产视频一区不卡| 色综合色综合色综合| 丝瓜av网站精品一区二区| 日韩欧美国产综合一区| 国产69精品久久777的优势| 亚洲三级免费电影| 91精品黄色片免费大全| 国产乱码精品一区二区三区五月婷| 国产精品欧美久久久久无广告| 在线观看亚洲精品| 久久精品国产77777蜜臀| 国产精品天干天干在观线| 在线免费观看不卡av| 美女网站在线免费欧美精品| 中文字幕av不卡| 欧美剧在线免费观看网站| 狠狠久久亚洲欧美| 国产精品日产欧美久久久久| 欧美三级乱人伦电影| 国产很黄免费观看久久| 一区二区激情小说| 精品成人一区二区三区四区| 91亚洲国产成人精品一区二区三| 日韩电影一区二区三区四区| 国产精品视频一区二区三区不卡| 欧美三级资源在线| 丁香网亚洲国际| 日本在线不卡视频一二三区| 国产精品美女视频| 精品日韩一区二区| 欧美亚洲禁片免费| 懂色一区二区三区免费观看| 日本视频在线一区| 《视频一区视频二区| 精品乱人伦一区二区三区| 91福利精品视频| 成人激情校园春色| 国内成人自拍视频|