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

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

?? task.cpp

?? 這是廣泛使用的通信開源項目,對于大容量,高并發的通訊要求完全能夠勝任,他廣泛可用于網絡游戲醫學圖像網關的高qos要求.更詳細的內容可閱讀相應的材料
?? CPP
字號:

// task.cpp,v 1.6 2003/11/09 20:44:19 dhinton Exp

#include "task.h"
#include "block.h"
#include "work.h"
#include "ace/Barrier.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一区二区三区免费野_久草精品视频
成人欧美一区二区三区| 国产精品久久一级| 欧美三级视频在线播放| 不卡一二三区首页| 成人高清视频在线观看| 成人aa视频在线观看| 国产传媒欧美日韩成人| 国产一区啦啦啦在线观看| 国产成人在线观看| eeuss鲁片一区二区三区在线看| 国产91丝袜在线播放| 丰满少妇久久久久久久| 一本色道久久加勒比精品| 午夜精品久久久久久久99樱桃| 亚洲尤物视频在线| 五月激情综合色| 久久精品国产77777蜜臀| 国产成人在线视频播放| 不卡高清视频专区| 欧美日韩黄色一区二区| 日韩精品专区在线影院重磅| 久久亚洲一区二区三区明星换脸 | 欧美视频在线播放| 91精品国产aⅴ一区二区| 精品国产乱码久久久久久久久 | 日本高清不卡一区| 91精品国产欧美日韩| 久久蜜桃av一区精品变态类天堂| 国产欧美一区二区精品秋霞影院| 亚洲视频免费观看| 日韩av高清在线观看| 国产精品综合一区二区| 日本精品视频一区二区| 欧美精品一区二区三区久久久| 国产精品天美传媒沈樵| 日韩专区中文字幕一区二区| 国产福利一区在线| 911精品产国品一二三产区| 国产亚洲欧美中文| 日韩在线观看一区二区| 国产91精品免费| 91精品麻豆日日躁夜夜躁| 国产精品美女久久久久久2018| 亚洲18女电影在线观看| 高潮精品一区videoshd| 欧美一二三四在线| 亚洲综合一区二区精品导航| 国产精品一区免费在线观看| 欧美视频自拍偷拍| 亚洲欧洲av色图| 狠狠色丁香久久婷婷综合丁香| 在线亚洲一区二区| 中文字幕永久在线不卡| 激情文学综合插| 91精品综合久久久久久| 亚洲最快最全在线视频| 岛国精品在线观看| 久久精品人人做人人爽人人| 日本aⅴ亚洲精品中文乱码| 91麻豆高清视频| 国产精品色在线观看| 狠狠色丁香九九婷婷综合五月| 欧美性色黄大片| 一区二区在线免费观看| 99re这里都是精品| 国产精品免费视频观看| 国产成人自拍网| 国产丝袜美腿一区二区三区| 久久99国内精品| 精品久久久久久无| 久久av老司机精品网站导航| 欧美麻豆精品久久久久久| 亚洲午夜私人影院| 精品视频1区2区3区| 亚洲在线一区二区三区| 在线亚洲+欧美+日本专区| 亚洲欧美综合色| 91麻豆成人久久精品二区三区| 中文字幕制服丝袜一区二区三区 | 国产成人亚洲综合a∨婷婷| 2017欧美狠狠色| 国产精品一区二区久久精品爱涩| 久久综合色8888| 国产麻豆成人传媒免费观看| 久久久久久**毛片大全| 成人免费三级在线| 中文字幕一区二区三区视频| 91麻豆精品秘密| 亚洲成a天堂v人片| 日韩女优视频免费观看| 国产在线播放一区二区三区| 国产亚洲综合在线| 91蜜桃网址入口| 午夜精品久久久久久久| 欧美一级理论片| 国产盗摄视频一区二区三区| 亚洲欧洲日韩综合一区二区| 欧美在线不卡视频| 麻豆91精品91久久久的内涵| 国产性做久久久久久| 一本大道综合伊人精品热热| 日韩一区精品字幕| 久久久噜噜噜久久中文字幕色伊伊 | av电影在线不卡| 亚洲精选视频免费看| 欧美日韩免费观看一区三区| 激情六月婷婷综合| 亚洲人成网站影音先锋播放| 91精品黄色片免费大全| 国产suv精品一区二区三区 | 欧美日韩高清一区| 国产久卡久卡久卡久卡视频精品| 亚洲三级电影网站| 欧美v日韩v国产v| 91啪亚洲精品| 紧缚奴在线一区二区三区| 亚洲欧洲av一区二区三区久久| 7777精品久久久大香线蕉| 成人一区二区三区视频在线观看| 亚洲高清免费观看高清完整版在线观看| 日韩一卡二卡三卡国产欧美| 99视频国产精品| 精品一区二区三区在线视频| 一区二区三区四区高清精品免费观看| 26uuu国产一区二区三区| 欧美在线一区二区三区| 风间由美一区二区三区在线观看| 亚洲国产另类精品专区| 国产女人18毛片水真多成人如厕 | 日韩av电影天堂| 亚洲视频一二三区| 久久女同精品一区二区| 欧美另类久久久品| 91亚洲永久精品| 国产精品一区二区三区乱码| 蜜桃视频免费观看一区| 亚洲午夜一二三区视频| 国产精品成人一区二区艾草| 精品国产免费一区二区三区四区| 欧美日韩精品二区第二页| 91免费版在线| 色综合久久久久综合99| 成人免费高清在线| 国产美女精品一区二区三区| 人禽交欧美网站| 日韩avvvv在线播放| 亚洲成人黄色影院| 亚洲国产视频直播| 亚洲午夜在线观看视频在线| 一区二区在线观看视频在线观看| 国产精品国模大尺度视频| 国产日韩v精品一区二区| 精品国产污污免费网站入口 | 国产精品你懂的在线| 久久久久久久av麻豆果冻| 久久蜜桃av一区精品变态类天堂 | 粉嫩aⅴ一区二区三区四区五区| 狠狠久久亚洲欧美| 国产精品一级二级三级| 国产精品一二二区| 成人综合婷婷国产精品久久| 不卡高清视频专区| 日本精品一区二区三区高清| 欧洲精品在线观看| 欧美精品在线一区二区| 日韩欧美一二区| 精品sm在线观看| 欧美激情在线一区二区| 亚洲素人一区二区| 亚洲国产日产av| 久久精品国产网站| 国产不卡免费视频| 色综合天天天天做夜夜夜夜做| 91电影在线观看| 欧美一级午夜免费电影| 久久久久亚洲综合| 综合网在线视频| 午夜精品久久久久久久蜜桃app| 久久精品国产一区二区三 | 国产精品一区不卡| 91啪亚洲精品| 日韩精品专区在线影院观看| 国产欧美日韩精品在线| 一区二区三区精品在线观看| 视频在线观看一区| 欧美伊人精品成人久久综合97| 欧美日韩成人综合| 久久免费电影网| 亚洲成av人片一区二区三区| 狠狠色狠狠色合久久伊人| 色综合一区二区三区| 日韩一区二区精品| 亚洲美女视频在线| 久久机这里只有精品| 色综合久久中文综合久久牛| 日韩精品影音先锋| 亚洲国产日韩av| 大尺度一区二区| 精品日韩在线观看| 亚洲一区二区三区美女|