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

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

?? task.cpp

?? 一個開源的網絡開發庫ACE
?? CPP
字號:

// task.cpp,v 1.5 1999/09/22 03:13:49 jcej Exp

#include "task.h"
#include "block.h"
#include "work.h"

/*
   Construct the Task with zero or more subtasks.  If subtasks are requested,
   we assign our next_ pointer to the first of those and let it worry about
   any remaining subtasks.
 */
Task::Task (int sub_tasks)
        : barrier_ (0)
         ,next_ (0)
{
    ACE_DEBUG ((LM_DEBUG, "(%P|%t) Task ctor 0x%x\n", (void *) this));
    if (sub_tasks)
    {
        next_ = new Task (--sub_tasks);
    }
}

/*
   Delete our barrier object and any subtasks we may have.
 */
Task::~Task (void)
{
    ACE_DEBUG ((LM_DEBUG, "(%P|%t) Task dtor 0x%x\n", (void *) this));

    delete barrier_;
    delete next_;
}

/*
   Open our thread pool with the requested number of threads.  If subtasks are
   enabled, they inherit the thread-pool size.  Make sure that the subtasks can
   be opened before we open our own threadpool.
 */
int Task::start (int threads)
{
    if (next_)
    {
        if (next_->start (threads) == -1)
        {
            return -1;
        }
    }

    barrier_ = new ACE_Barrier (threads);
    return this->activate (THR_NEW_LWP, threads);
}

/*
   Close ourselves and any subtasks.  This just prints a message so that we can
   assure ourselves things are cleaned up correctly.
 */
int Task::close (u_long flags)
{
    ACE_DEBUG ((LM_DEBUG, "(%P|%t) Task close 0x%x\n", (void *) this));
    if (next_)
    {
        next_->close (flags);
    }

    return (0);
}

/*
   Wait for all of the threads in our pool to exit and then wait for any
   subtasks.  When called from the front of the task chain, this won't return
   until all thread pools in the chain have exited.
 */
int Task::wait (void)
{
    inherited::wait ();
    if (next_)
    {
        next_->wait ();
    }
    return (0);
}

/*
   Like the thread-pools before, this is where all of the work is done.
 */
int Task::svc (void)
{
        // Wait for all threads to get this far before continuing.
    this->barrier_->wait ();

    ACE_DEBUG ((LM_DEBUG, "(%P|%t) Task 0x%x starts in thread %u\n", (void *) this, ACE_Thread::self ()));

        // getq() wants an ACE_Message_Block so we'll start out with one
        // of those.  We could do some casting (or even auto-casting) to
        // avoid the extra variable but I prefer to be clear about our actions.
    ACE_Message_Block *message;

        // What we really put into the queue was our Message_Block.
        // After we get the message from the queue, we'll cast it to this
        // so that we know how to work on it.
    Message_Block *message_block;

        // And, of course, our Message_Block contains our Data_Block
        // instead of the typical ACE_Data_Block
    Data_Block *data_block;

      // Even though we put Work objects into the queue, we take them
      // out using the baseclass pointer.  This allows us to create new
      // derivatives without having to change this svc() method.
    Unit_Of_Work *work;

    while (1)
    {
            // Get the ACE_Message_Block
        if (this->getq (message) == -1)
        {
            ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getq"), -1);
        }

            // "Convert" it to our Message_Block
        message_block = (Message_Block *) message;

            // Get the ACE_Data_Block and "convert" to Data_Block in one step.
        data_block = (Data_Block *) (message_block->data_block ());

            // Get the unit of work from the data block
        work = data_block->data ();

            // Show the object's instance value and "type name"
        work->who_am_i ();
        work->what_am_i ();

            // If there is a hangup we need to tell our pool-peers as
            // well as any subtasks.
        if (message_block->msg_type () == ACE_Message_Block::MB_HANGUP)
        {
                // duplicate()ing the message block will increment the
                // reference counts on the data blocks.  This allows us
                // to safely release() the message block.  The rule of
                // thumb is that if you pass a message block to a new
                // owner, duplicate() it.  Then you can release() when
                // you're done and not worry about memory leaks.
            if (this->putq (message_block->duplicate ()) == -1)
            {
                ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "putq"), -1);
            }

                // If we have a subtask, duplicate() the message block
                // again and pass it to that task's queue
            if (next_ && next_->putq (message_block->duplicate ()) == -1)
            {
                ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "putq"), -1);
            }

                // We're now done with our copy of the block, so we can
                // release it.  Our peers/subtasks have their own message
                // block to access the shared data blocks.
            message_block->release ();

            break;
        }

            // If this isn't a hangup/shutdown message then we tell the
            // unit of work to process() for a while.
        work->process ();

        if (next_)
        {
                // If we have subtasks, we pass the block on to them.  Notice
                // that I don't bother to duplicate() the block since I won't
                // release it in this case.  I could have invoked
                // duplicate() in the puq() and then release()
                // afterwards.  Either is acceptable.
            if (next_->putq (message_block) == -1)
                ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "putq"), -1);
        }
        else
        {
                // If we don't have subtasks then invoke fini() to tell
                // the unit of work that we won't be invoking process()
                // any more.  Then release() the block.  This release()
                // would not change if we duplicate()ed in the above conditional
            work->fini ();
            message_block->release ();
        }

            // Pretend that the work takes some time...
        ACE_OS::sleep (ACE_Time_Value (0, 250));
    }

    return (0);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三中文字幕 | 成人av网址在线| 亚洲国产一区二区三区青草影视| 国产精品免费看片| 久久久精品国产免大香伊| 精品精品欲导航| 精品国产三级电影在线观看| 欧美成人激情免费网| 精品av久久707| 久久综合av免费| 亚洲国产精品成人久久综合一区| 国产亚洲午夜高清国产拍精品 | 国产日韩欧美a| 国产日韩精品一区二区三区在线| 国产欧美精品一区| 亚洲乱码国产乱码精品精98午夜| 亚洲精品视频在线| 日韩av中文在线观看| 久久国产精品无码网站| 国产剧情一区二区| 一本一道综合狠狠老| 欧美日韩一二三区| 欧美精品一区二区三区蜜臀| 久久精品一区二区| 一区二区免费在线播放| 图片区小说区国产精品视频 | 精品区一区二区| 久久精品视频免费| 一区二区三区在线免费播放| 日本一不卡视频| 成人app在线观看| 欧美精三区欧美精三区| 国产亚洲精品bt天堂精选| 国产精品传媒视频| 全国精品久久少妇| 成人国产在线观看| 欧美一卡在线观看| 亚洲丝袜制服诱惑| 精东粉嫩av免费一区二区三区| 国产成人精品在线看| 欧美午夜电影一区| 国产精品色一区二区三区| 偷窥少妇高潮呻吟av久久免费| 国产精品亚洲视频| 欧美老女人在线| 亚洲欧洲一区二区在线播放| 三级一区在线视频先锋| 99久久久久免费精品国产| 日韩亚洲欧美在线观看| 亚洲激情中文1区| 国产精一区二区三区| 欧美日本乱大交xxxxx| 中文字幕一区二区三区蜜月| 麻豆精品视频在线| 欧美性一区二区| 成人欧美一区二区三区黑人麻豆| 日韩和欧美一区二区三区| 91麻豆视频网站| 欧美国产激情一区二区三区蜜月| 日韩国产欧美在线播放| 欧美在线不卡视频| 亚洲欧美激情在线| 不卡区在线中文字幕| 精品国产乱码久久久久久1区2区 | 欧美巨大另类极品videosbest | 91视频一区二区三区| 久久综合成人精品亚洲另类欧美 | 国产成人av一区二区三区在线| 在线播放视频一区| 免费成人av资源网| 欧美手机在线视频| 亚洲影视在线播放| 91久久精品一区二区| 亚洲欧洲成人自拍| 99视频在线观看一区三区| 国产精品三级av| 成人午夜免费av| 中文字幕在线观看一区二区| 成人av电影免费在线播放| 国产欧美1区2区3区| 国产a区久久久| 中文字幕乱码日本亚洲一区二区 | 日韩福利视频导航| 欧美精品 日韩| 日本在线观看不卡视频| 精品国精品国产尤物美女| 国产美女视频91| 国产精品沙发午睡系列990531| 国产91清纯白嫩初高中在线观看| 中文一区二区在线观看| 成av人片一区二区| 一区二区三区日韩欧美精品| 91国偷自产一区二区使用方法| 亚洲一区二区三区影院| 91精品国产一区二区人妖| 激情欧美一区二区三区在线观看| 久久久久久99久久久精品网站| 成人性生交大片免费看中文| 亚洲欧美日韩成人高清在线一区| 欧美综合一区二区| 狠狠色狠狠色综合系列| 国产精品日日摸夜夜摸av| 91丨国产丨九色丨pron| 日本在线不卡一区| 中文一区在线播放| 欧美日韩和欧美的一区二区| 韩国欧美一区二区| 亚洲视频图片小说| 日韩欧美一二区| 91日韩一区二区三区| 日韩精品一区第一页| 国产亲近乱来精品视频| 精品国产乱码91久久久久久网站| 国产精品一卡二| 亚洲国产精品一区二区久久| 精品电影一区二区三区| 一本色道久久综合亚洲91| 免播放器亚洲一区| 亚洲欧洲日产国码二区| 欧美大白屁股肥臀xxxxxx| proumb性欧美在线观看| 麻豆免费看一区二区三区| 亚洲欧洲精品成人久久奇米网| 91精品国产麻豆国产自产在线 | 图片区小说区国产精品视频| 国产欧美精品日韩区二区麻豆天美| 欧美亚洲国产怡红院影院| 国产91精品一区二区| 麻豆精品国产传媒mv男同| 依依成人精品视频| 欧美激情综合五月色丁香| 欧美一区二区大片| 欧美日韩精品专区| 欧美在线观看一区| 99久久免费视频.com| 国产不卡视频一区| 国产高清久久久| 国内精品伊人久久久久av影院 | 麻豆91在线播放| 亚洲小说欧美激情另类| 亚洲色图欧洲色图| 国产精品久久久久久福利一牛影视 | 99久久久免费精品国产一区二区| 蓝色福利精品导航| 美女一区二区三区在线观看| 亚洲图片欧美视频| 一区二区三区精品视频| 亚洲男同1069视频| 亚洲三级在线免费| 亚洲欧美日韩中文播放 | 日韩欧美一二区| 日韩一级免费观看| 制服丝袜在线91| 欧美日本视频在线| 日韩欧美国产综合一区| 日韩一区二区三区高清免费看看| 欧美猛男超大videosgay| 欧美日韩高清在线播放| 欧美视频在线观看一区二区| 欧美日韩中文国产| 91超碰这里只有精品国产| 4438x亚洲最大成人网| 日韩一级黄色片| 久久蜜桃av一区二区天堂 | 亚洲国产欧美在线人成| 亚洲午夜激情网页| 日韩av一区二区三区| 久久99精品久久久久久动态图| 麻豆一区二区三| 成人丝袜18视频在线观看| 成人不卡免费av| 欧美亚洲综合久久| 日韩久久免费av| 亚洲国产精品激情在线观看| 一区二区三区欧美激情| 日韩国产精品91| 国产精品一区二区在线观看不卡| 成人午夜伦理影院| 欧美日韩亚洲高清一区二区| 欧美电影免费观看高清完整版在线观看| 欧美xingq一区二区| 国产女人18毛片水真多成人如厕 | 日韩中文字幕av电影| 九色|91porny| 色综合咪咪久久| 精品日韩欧美在线| 椎名由奈av一区二区三区| 五月天亚洲婷婷| 成人黄动漫网站免费app| 欧美精品1区2区3区| 国产三级三级三级精品8ⅰ区| 一二三四社区欧美黄| 久久99精品久久久久久国产越南 | 亚洲成av人在线观看| 激情欧美一区二区三区在线观看| 91免费国产在线| 国产日韩欧美高清| 日产精品久久久久久久性色| 成人午夜短视频| 欧美va亚洲va香蕉在线|