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

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

?? task.cpp

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

// Tutorial regarding a way to use ACE_Stream.
//
// written by bob mcwhirter (bob@netwrench.com)

#include <ace/Message_Block.h>

#include "Task.h"

Task::Task (const char * nameOfTask,
            int numberOfThreads)
  : d_numberOfThreads (numberOfThreads),
    d_barrier (numberOfThreads)
{
  // Just initialize our name, number of threads, and barrier.

  ACE_OS::strcpy (d_nameOfTask, nameOfTask);
}

Task::~Task (void)
{
  ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::~Task () -- once per Task\n", d_nameOfTask));
}

int Task::open (void *arg)
{
  ACE_UNUSED_ARG (arg);

  ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::open () -- once per Task\n", d_nameOfTask));

  // call ACE_Task::activate () to spawn the threads using
  // our Task::svc () as the function to be run.

  // No need to use THR_DETACHED here, we're going to wait ()
  // for the threads to exit later.  No leaks.

  return this->activate (THR_NEW_LWP, d_numberOfThreads);
}

int Task::put (ACE_Message_Block *message,
          ACE_Time_Value *timeout)
{
  // ACE_Stream uses the put () method of Tasks to send messages.
  // This defaultly does nothing.  Here we link our put () method
  // directly to our putq () method, so that Messages put () to us
  // will appear in the Message_Queue that is checked by the
  // service threads.

  return this->putq (message, timeout);
}

int Task::close (u_long flags)
{
  // When the Stream closes the Module, the Module then close ()'s the Task
  // and passing a value of (1) as the flag.

  // When a service thread exits, it calls close () with a value that is not
  // (1).

  // We use this fact to tell the difference between closing a service thread,
  // and closing the main Task itself.

  if (flags == 1) {
    // The Module has asked to close the main Task.

    ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::close () -- flags == 1 -- once per Task\n", d_nameOfTask));

    // We create a Message_Block of type MB_HANGUP.

    ACE_Message_Block *hangupBlock;

    // Note the use of the lock_adapter () to ensure proper serialization.
    ACE_NEW_RETURN (hangupBlock,
 		    ACE_Message_Block (0,
 			 	       ACE_Message_Block::MB_HANGUP,
 			 	       0,
 			 	       0,
 			  	       0,
 			 	       Task::lock_adapter ()),
                    -1);

    // We then send this Block into the Message_Queue to be seen by the
    // service threads.

    // Once again we duplicate () the Block as send it off...

    if (this->putq (hangupBlock->duplicate ()) == -1) {
      ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Task::close () putq"), -1);
    }

    // ..and we're free to release () our copy of it.

    hangupBlock->release ();

    // Now, all we have to do is wait () for the service threads to all
    // exit.  This is where using THR_DETACHED in the activate () method
    // will come back to haunt you.

    // The Stream waits until this returns before attempting to remove
    // the next Module/Task group in the Stream.  This allows for an
    // orderly shutting down of the Stream.

    return this->wait ();
  } else {
    ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::close () -- flags != 1 -- once per servicing thread\n", d_nameOfTask));

    // This is where we can clean up any mess left over by each service thread.
    // In this Task, there is nothing to do.
  }
  return 0;
}

int Task::svc (void)
{
  // This is the function that our service threads run once they are spawned.

  ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::svc () -- once per servicing thread\n", d_nameOfTask));

  // First, we wait until all of our peer service threads have arrived
  // at this point also.

  d_barrier.wait ();

  ACE_Message_Block *messageBlock;

  while (1) {
    // And now we loop almost infinitely.

    // getq () will block until a Message_Block is available to be read,
    // or an error occurs.

    if ( this->getq (messageBlock, 0) == -1) {
      ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Task::svc () getq"), -1);
    }

    if (messageBlock->msg_type () == ACE_Message_Block::MB_HANGUP) {

      // If the Message_Block is of type MB_HANGUP, then we're being asked
      // to shut down nicely.

      ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::svc () -- HANGUP block received\n", d_nameOfTask));

      // So, we duplicate the Block, and put it back into the Message_Queue,
      // in case there are some more peer service threads still running.

      if (this->putq (messageBlock->duplicate ()) == -1) {
    ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Task::svc () putq"), -1);
      }

      // We release our copy of the Block.
      messageBlock->release ();

      // And we break out of the nearly infinitely loop, and
      // head towards close () ourselves.
      break;
    }

    // If we're here, then we've received a Message_Block that was
    // not informing us to quit, so we're assuming it's a valid
    // meaningful Block.

    ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::svc () -- Normal block received\n", d_nameOfTask));

    // We grab the read-pointer from the Block, and display it through a DEBUG statement.

    ACE_DEBUG ((LM_DEBUG, " (%P|%t) %s Task::svc () -- %s\n", d_nameOfTask, messageBlock->rd_ptr () ));

    // We pretend that this takes to time to process the Block.
    // If you're on a fast machine, you might have to raise this
    // value to actually witness different threads handling
    // blocks for each Task.

    ACE_OS::sleep (ACE_Time_Value (0, 250));

    // Since we're part of a Stream, we duplicate the Block, and
    // send it on to the next Task.

    if (put_next (messageBlock->duplicate ()) == -1) {
      ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Task::svc () put_next"), -1);
    }

    // And then we release our copy of it.

    messageBlock->release ();
  }
  return 0;
}

const char *Task::nameOfTask (void) const
{
  return d_nameOfTask;
}

ACE_Lock_Adapter<ACE_SYNCH_MUTEX> *Task::lock_adapter (void) 
{
  return &lock_adapter_;
}

// Static definition.
ACE_Lock_Adapter<ACE_SYNCH_MUTEX> Task::lock_adapter_;

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Lock_Adapter <ACE_SYNCH_MUTEX>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Lock_Adapter <ACE_SYNCH_MUTEX>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区不卡视频| 91蜜桃免费观看视频| 678五月天丁香亚洲综合网| 一区二区三区电影在线播| 欧美中文字幕久久| 天天综合网天天综合色| 日韩欧美一区电影| 国产综合色精品一区二区三区| 亚洲精品在线免费播放| 国产精品18久久久久久久久| 国产精品久久久99| 在线精品视频免费观看| 视频一区在线播放| www激情久久| 9i在线看片成人免费| 亚洲一区二区三区精品在线| 在线不卡中文字幕播放| 国产久卡久卡久卡久卡视频精品| 国产精品高清亚洲| 欧美日韩成人综合天天影院| 久久精品国产99国产| 国产精品欧美一区喷水| 欧美主播一区二区三区美女| 激情文学综合插| 亚洲欧洲性图库| 亚洲欧洲99久久| 欧美性色综合网| 国内成人自拍视频| 亚洲欧美国产三级| 精品国产污网站| 91视频观看免费| 久久99精品网久久| 亚洲欧美一区二区久久| 精品美女在线播放| 色综合天天视频在线观看| 裸体一区二区三区| 亚洲卡通动漫在线| 国产亚洲精品bt天堂精选| 日本高清不卡视频| 国产乱码精品一区二区三区av | 久久久久久影视| 在线观看成人小视频| 国产成人精品综合在线观看| 亚洲国产欧美日韩另类综合| 日本一区二区动态图| 日韩一区二区三区免费观看| 色哟哟国产精品| 国产成人一区在线| 奇米影视一区二区三区| 一区二区激情视频| 中文字幕一区二区在线播放| 欧美成人一区二区三区在线观看| 在线视频你懂得一区| 成人高清视频在线| 精品亚洲国产成人av制服丝袜| 亚洲午夜羞羞片| 最新国产成人在线观看| 国产人妖乱国产精品人妖| 欧美一区二区性放荡片| 欧美三级午夜理伦三级中视频| 成人av在线电影| 福利91精品一区二区三区| 理论片日本一区| 日韩综合小视频| 亚洲成人黄色影院| 亚洲永久精品大片| 亚洲一区二区在线免费观看视频 | 99在线精品一区二区三区| 国产一区二区电影| 激情伊人五月天久久综合| 奇米影视一区二区三区小说| 丝袜a∨在线一区二区三区不卡| 亚洲精品久久久久久国产精华液 | 亚洲视频在线一区| 国产精品毛片久久久久久久| 中文字幕第一区| 日本一二三四高清不卡| 国产精品美女视频| 中文一区二区在线观看 | 自拍偷自拍亚洲精品播放| 国产精品美女久久久久高潮| 国产精品免费久久久久| 国产精品视频一二三区| 中文字幕在线观看不卡视频| 国产精品国产自产拍在线| 亚洲视频一二区| 亚洲精品视频在线| 亚洲va欧美va人人爽| 亚洲不卡av一区二区三区| 天堂av在线一区| 日本aⅴ免费视频一区二区三区| 麻豆成人91精品二区三区| 国产在线视频一区二区| 成人av在线影院| 欧洲视频一区二区| 欧美一区二区三区播放老司机| 日韩视频免费观看高清完整版| 精品区一区二区| 国产欧美视频在线观看| 亚洲视频 欧洲视频| 亚洲va欧美va人人爽| 日本亚洲天堂网| 国产ts人妖一区二区| 色悠悠亚洲一区二区| 制服丝袜激情欧洲亚洲| 久久久久亚洲综合| 亚洲精品自拍动漫在线| 视频一区二区三区在线| 国产成人亚洲综合a∨婷婷图片| 99久久精品免费看| 欧美丰满少妇xxxxx高潮对白 | 日韩精品一级中文字幕精品视频免费观看| 三级久久三级久久久| 国产精品1024| 欧洲av一区二区嗯嗯嗯啊| 日韩午夜中文字幕| 国产精品高潮久久久久无| 婷婷一区二区三区| 福利电影一区二区三区| 精品视频色一区| 欧美—级在线免费片| 亚洲成av人片在线观看无码| 国产精品亚洲午夜一区二区三区| 一本色道亚洲精品aⅴ| 欧美va在线播放| 亚洲精品水蜜桃| 国产一二精品视频| 欧美色综合久久| 欧美国产成人精品| 秋霞电影一区二区| 日本精品一级二级| 国产日韩在线不卡| 美腿丝袜在线亚洲一区 | 国产精品一区2区| 欧美日韩国产高清一区| 亚洲国产精品t66y| 日本不卡一区二区三区| 波多野结衣一区二区三区 | 欧美三级电影在线看| 国产调教视频一区| 奇米影视7777精品一区二区| 色欧美日韩亚洲| 国产精品每日更新在线播放网址| 免费高清成人在线| 欧美日韩精品福利| 1024成人网色www| 成人午夜视频免费看| 精品久久久久一区| 日韩激情中文字幕| 欧美调教femdomvk| 亚洲免费成人av| 成人午夜又粗又硬又大| 国产三级欧美三级日产三级99| 日本系列欧美系列| 欧美日韩高清在线| 亚洲国产aⅴ天堂久久| 日本精品裸体写真集在线观看| 国产精品免费视频网站| 国产成人av一区二区三区在线 | 国产精品五月天| 国产精品亚洲午夜一区二区三区 | 中文字幕免费在线观看视频一区| 精品一区二区综合| 精品国产免费人成在线观看| 麻豆精品久久精品色综合| 欧美精选午夜久久久乱码6080| 亚洲一级二级三级| 欧美在线三级电影| 亚洲成人在线观看视频| 欧美视频中文字幕| 午夜精品久久久久影视| 欧美日本在线看| 五月婷婷欧美视频| 欧美日韩国产a| 久久精品国产精品亚洲红杏| 欧美成人r级一区二区三区| 精久久久久久久久久久| 久久久久久久久久电影| 国产91精品久久久久久久网曝门| 国产蜜臀97一区二区三区 | 老司机精品视频导航| 精品人在线二区三区| 国产91丝袜在线播放九色| 国产精品美女久久久久aⅴ| 色综合一个色综合| 一区二区三区不卡在线观看| 欧美麻豆精品久久久久久| 蜜臀久久99精品久久久画质超高清| 欧美一区在线视频| 国产一区二区剧情av在线| 国产精品久久免费看| 欧美性一二三区| 美女被吸乳得到大胸91| 国产精品网站一区| 欧美中文字幕亚洲一区二区va在线 | 91黄色免费版| 久久精品国产精品青草| 国产精品美女久久久久久| 日本高清成人免费播放| 开心九九激情九九欧美日韩精美视频电影 |