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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mboxt.inl

?? ecos下的gui開發源代碼
?? INL
?? 第 1 頁 / 共 2 頁
字號:
#ifndef CYGONCE_KERNEL_MBOXT_INL
#define CYGONCE_KERNEL_MBOXT_INL
//==========================================================================
//
//      mboxt.inl
//
//      Mboxt 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:     Mboxt template implementation
// Description: This file contains the implementations of the mboxt
//              template classes.
//
//####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/mboxt.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_Mboxt<T,QUEUE_SIZE>::wakeup_waiter( Cyg_ThreadQueue &q )
{
    if( !q.empty() ) {
        // The queue is non-empty, so grab the next thread and wake it up.
        Cyg_Thread *thread = q.dequeue();

        CYG_ASSERTCLASS( thread, "Bad thread pointer");

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

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

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

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

template <class T, cyg_count32 QUEUE_SIZE>
Cyg_Mboxt<T,QUEUE_SIZE>::~Cyg_Mboxt()
{
    CYG_REPORT_FUNCTION();
    CYG_ASSERT( 0 == count, "Deleting mboxt with messages");
    CYG_ASSERT( get_threadq.empty(), "Deleting mboxt with threads waiting to get");
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
    CYG_ASSERT( put_threadq.empty(), "Deleting mboxt with threads waiting to put");
#endif
}

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

#ifdef CYGDBG_USE_ASSERTS

template <class T, cyg_count32 QUEUE_SIZE>
cyg_bool 
Cyg_Mboxt<T,QUEUE_SIZE>::check_this(cyg_assert_class_zeal zeal) const
{
    CYG_REPORT_FUNCTION();
        
    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;
      
        // there was initially a test of the form
        //    (0 < count && count < size) && ! threadqueue.empty()
        // here - ie. there should only be people waiting if the Q is full
        // or empty.  This is bogus, anyone else might run between a waiter
        // being awoken, so there can be a 2nd waiter in the Q and a free
        // slot (say) simultaneously.

        // Further, we need 2 queues; imagine a 10-slot itemqueue with 25
        // attempts to put to it, so 15 sleep.  10 other threads get,
        // awakening 10 of the 15 put-sleepers.  Another one gets, and
        // can't because there is no data there _yet_; it sleeps, and the
        // 10 awakened threads cycle through the run queue, each putting,
        // the first awakens the get-sleeper, which in turn awakens a
        // further put-sleeper.

        // This requirement for 2 queue only holds if Ngetters > 2 * Nslots
        // or Nputters > 2 * Nslots; if these are both false, one queue
        // will suffice.  This could be an optimisation for the future -
        // wow, 4 bytes.

    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_Mboxt<T,QUEUE_SIZE>::get( T &ritem )
{
    CYG_REPORT_FUNCTION();
    cyg_bool result = true;
        
    Cyg_Thread *self = Cyg_Thread::self();
    
    // Prevent preemption
    Cyg_Scheduler::lock();

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

    // Loop while the mboxt is empty, sleeping each time around
    // the loop. This copes with the possibility of a higher priority
    // thread grabbing the message between the wakeup in unlock() and
    // this thread actually starting.
    
    while( result && (0 == count) ) {
        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");        

        // Allow other threads to run
        Cyg_Scheduler::reschedule();

        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;
        }
    }

    if ( result ) {
        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_waiter( put_threadq );
#endif
    }

    CYG_ASSERTCLASS( this, "Bad this pointer");

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

    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_Mboxt<T,QUEUE_SIZE>::get( T &ritem, cyg_tick_count abs_timeout )
{
    CYG_REPORT_FUNCTION();
    cyg_bool result = true;
        
    Cyg_Thread *self = Cyg_Thread::self();
    
    // Prevent preemption
    Cyg_Scheduler::lock();

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

    // Set the timer _once_ outside the loop.
    self->set_timer( abs_timeout, Cyg_Thread::TIMEOUT  );

    // If the timeout is in the past, the wake reason will have been
    // set to something other than NONE already. Set the result false
    // to force an immediate return.
    
    if( self->get_wake_reason() != Cyg_Thread::NONE )
        result = false;
                
    // Loop while the mboxt is empty, sleeping each time around the loop.
    // This copes with the possibility of a higher priority thread grabbing
    // the message between the wakeup in put()&c and this thread actually
    // starting.
    while ( result && (0 == count) ) {
        // must reset the sleep reason every time
        self->set_sleep_reason( Cyg_Thread::TIMEOUT );
        self->sleep();
        get_threadq.enqueue( self );

        CYG_INSTRUMENT_MBOXT(WAIT, this, count);

        // Allow other threads to run
        Cyg_Scheduler::reschedule();

        CYG_ASSERTCLASS( this, "Bad this pointer");        

        switch( self->get_wake_reason() )
        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色大成网站www久久九九| 在线欧美日韩精品| 国产日本亚洲高清| 综合亚洲深深色噜噜狠狠网站| 欧美xxxxx牲另类人与| 欧美成人女星排行榜| 日韩不卡手机在线v区| 日韩免费视频一区二区| 久久99精品国产麻豆婷婷洗澡| 欧美videos大乳护士334| 国产伦精品一区二区三区免费迷 | 国产欧美一区二区精品秋霞影院| 国产成人在线观看| 亚洲乱码国产乱码精品精小说| 色欧美日韩亚洲| 麻豆91在线播放免费| 久久久精品天堂| 99国产欧美另类久久久精品| 亚洲在线免费播放| 日韩欧美久久一区| 99久久久免费精品国产一区二区| 亚洲一区二区三区美女| 日韩欧美综合一区| 成人av资源站| 成人免费视频视频在线观看免费| 中文字幕一区免费在线观看| 欧美日韩精品一区二区在线播放| 日本亚洲视频在线| 国产精品福利av| 欧美一级在线视频| 不卡影院免费观看| 日韩国产精品久久久久久亚洲| 久久久99精品免费观看不卡| 91美女在线视频| 国产综合久久久久久久久久久久 | 欧美一区二区黄色| proumb性欧美在线观看| 日韩极品在线观看| 中文字幕日韩一区| 欧美一区二区三区四区高清 | 久久成人精品无人区| 国产精品青草久久| 欧美一二三区在线| 欧美丝袜第三区| 99久久精品国产毛片| 久久国产精品99精品国产| 亚洲精品国久久99热| 国产欧美一区二区三区网站| 欧美精品一二三区| 91视频在线观看| 成人妖精视频yjsp地址| 麻豆免费看一区二区三区| 亚洲码国产岛国毛片在线| 久久久久久久久久久99999| 这里只有精品99re| 在线这里只有精品| 色婷婷精品大视频在线蜜桃视频| 国产一区二区三区在线观看免费| 亚洲成人自拍网| 亚洲精品美国一| 中文字幕在线观看不卡| 亚洲精品一区二区三区福利| 欧美一区二区播放| 欧美一区二区三区影视| 欧美一区二区视频免费观看| 欧美日韩视频一区二区| 欧美亚洲国产怡红院影院| 色婷婷av一区二区三区gif| fc2成人免费人成在线观看播放| 国产一区二区三区四| 国产一区二区三区电影在线观看| 奇米在线7777在线精品 | 欧美第一区第二区| 精品奇米国产一区二区三区| 91精品国产色综合久久不卡蜜臀| 欧美日产在线观看| 欧美精品日韩一区| 911国产精品| 日韩视频一区二区三区| 欧美日韩国产在线观看| 欧美日韩卡一卡二| 老汉av免费一区二区三区| 2019国产精品| 亚洲成人在线免费| 国产日韩欧美麻豆| 欧美成人官网二区| 欧美日韩精品福利| 欧美视频在线观看一区二区| 成人精品gif动图一区| 国产麻豆精品95视频| 日韩高清不卡一区二区三区| 一区二区三区不卡在线观看| 亚洲成av人**亚洲成av**| 中文字幕日韩一区二区| 亚洲精品少妇30p| 亚洲精选在线视频| 亚洲.国产.中文慕字在线| 日欧美一区二区| 九一九一国产精品| 国产成人综合亚洲网站| 9色porny自拍视频一区二区| 色播五月激情综合网| 欧美日韩高清一区二区不卡| 99re成人在线| 日韩毛片一二三区| 17c精品麻豆一区二区免费| 国产一区三区三区| 视频一区二区三区中文字幕| 日本不卡一区二区| 激情丁香综合五月| yourporn久久国产精品| 欧美亚日韩国产aⅴ精品中极品| 欧美剧情片在线观看| 26uuu久久综合| 亚洲女女做受ⅹxx高潮| 视频一区免费在线观看| 成人午夜免费视频| 欧美日韩专区在线| 久久久精品日韩欧美| 亚洲一区二区三区精品在线| 国产制服丝袜一区| 色婷婷精品大在线视频 | 久久国产精品99久久人人澡| av综合在线播放| 欧美一卡二卡在线观看| 国产精品久久久久久亚洲伦| 亚洲成在人线免费| 成人av在线影院| 欧美一区二区三区影视| 亚洲精品美腿丝袜| 高清国产一区二区| 欧美另类变人与禽xxxxx| 久久网这里都是精品| 亚洲电影一级黄| 99精品一区二区| 久久香蕉国产线看观看99| 亚洲国产aⅴ成人精品无吗| 国产高清在线精品| 日韩欧美成人一区| 亚洲18色成人| 欧洲亚洲国产日韩| 亚洲人成网站在线| 成人av免费在线| 日韩视频中午一区| 丝袜美腿亚洲综合| 欧美最猛黑人xxxxx猛交| 国产精品久久久久久久久免费相片| 美日韩一区二区三区| 精品视频全国免费看| 中文字幕视频一区二区三区久| 国产一区二区三区免费在线观看| 欧美精品久久久久久久多人混战| 中文字幕五月欧美| 不卡免费追剧大全电视剧网站| 精品久久人人做人人爰| 免费精品99久久国产综合精品| 日韩一区二区不卡| 日韩制服丝袜先锋影音| 91激情五月电影| 亚洲精品久久久蜜桃| 91在线视频官网| 亚洲视频 欧洲视频| 成人av午夜电影| 欧美高清在线视频| 懂色av一区二区三区免费观看| 精品日韩欧美一区二区| 国产在线国偷精品产拍免费yy | 日韩欧美国产午夜精品| 蜜桃一区二区三区在线| 日韩视频在线观看一区二区| 蜜臀久久99精品久久久久久9 | 亚洲一区二区三区中文字幕| 色诱亚洲精品久久久久久| 亚洲情趣在线观看| 欧美最新大片在线看| 一区二区国产盗摄色噜噜| 色婷婷国产精品久久包臀| 有坂深雪av一区二区精品| 日本韩国视频一区二区| 亚洲影视在线观看| 欧美精品视频www在线观看 | 国产校园另类小说区| 高清国产一区二区| 亚洲精品成人天堂一二三| 欧美调教femdomvk| 日本不卡免费在线视频| 精品国产一区二区三区久久久蜜月| 国产在线精品一区在线观看麻豆| 久久久综合精品| 色综合久久中文综合久久97| 亚洲夂夂婷婷色拍ww47| 欧美一区二区在线播放| 国产精品456露脸| 亚洲日本在线天堂| 91精品国产高清一区二区三区蜜臀| 久久不见久久见免费视频1| 国产欧美精品在线观看| 99久久99久久精品国产片果冻| 亚洲成人7777| 国产欧美va欧美不卡在线|