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

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

?? condition.cpp

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

// condition.cpp,v 1.4 2003/11/09 20:44:19 dhinton Exp

#include "Condition_i.h"
#include "ace/Task.h"
#include "ace/OS_NS_unistd.h"

/* In order to test our Condition we'll derive from ACE_Task<> so that
   we can have several threads accessing the condition variable
   together.
 */
class Test : public ACE_Task<ACE_NULL_SYNCH>
{
public:
     // Construct the condition variable with an initial value.
    Test( int _max_threads, Condition::value_t _value );
    ~Test(void);

     // Open the Task with enough threads to make a useful test.
    int open(void);

protected:
     // Each thread will do work on the Condition.
    int svc(void);

     // Override this method to modify the Condition in some way.
    virtual void modify(void) = 0;

     // Override this to test the Condition in some way.
    virtual void test(void) = 0;

     // How many threads to use in the test.  This is also used in the
     // modify() and test() methods of the derivatives.
    int max_threads_;

     // We want to sleep for a random amount of time to simulate
     // work.  The seed is necessary for proper random number generation.
    ACE_RANDR_TYPE seed_;

     // This is the actual condition variable set.
    Condition condition_;
};

// Initialize the condition variable.
Test::Test( int _max_threads, Condition::value_t _value )
        : max_threads_(_max_threads), condition_(_value)
{
    ;
}

Test::~Test(void)
{
    ;
}

// Seed the random number generator and start the threads.
int Test::open(void)
{
    seed_ = ACE_OS::gettimeofday().usec();

    ACE_OS::srand( seed_ );

        // This is not a place where we want to use THR_DETACHED.
        // We're going to be waiting for our threads and if we detach
        // them, we'll loose track and horrible things will happen.
    return this->activate(THR_NEW_LWP, max_threads_);
}

/* Each thread will modify the condition variable in some way and then
   wait for the condition to be satisfied.  The derived classes
   overload modify() and test() to implement a specific test of the
   Condition class.
 */
int Test::svc(void)
{
        // Take a moment before we modify the condition.  This will
        // cause test() in other threads to delay a bit.
    int stime = ACE_OS::rand_r( seed_ ) % 5;
    ACE_OS::sleep(abs(stime)+2);

    ACE_DEBUG ((LM_INFO, "(%P|%t|%T)\tTest::svc() befor modify, condition_ is:  %d\n", (int)condition_ ));

     // Change the condition variable's value
    modify();

    ACE_DEBUG ((LM_INFO, "(%P|%t|%T)\tTest::svc() after modify, condition_ is:  %d\n", (int)condition_ ));

     // Test for the condition we want
    test();

    ACE_DEBUG ((LM_INFO, "(%P|%t|%T)\tTest::svc() leaving.\n" ));

    return(0);
}

/* Test Condition::operator!=()
   The task's svc() method will increment the condition variable and
   then wait until the variable's value reaches max_threads_.
 */
class Test_ne : public Test
{
public:
     // Initialize the condition variable to zero since we're counting up.
    Test_ne( int _max_threads )
            : Test(_max_threads,0)
        {
            ACE_DEBUG ((LM_INFO, "\n(%P|%t|%T)\tTesting condition_ != %d\n", max_threads_));
        }

     // Increment the variable
    void modify(void)
        {
            ++condition_;
        }

     // Wait until it equals max_threads_
    void test(void)
        {
            condition_ != max_threads_;
        }
};

/* Test Condition::operator>=()
   Each svc() method will decrement the condition variable and wait
   until it is less than max_threads_.  To do this correctly, we have
   to be careful where we start the condition variable.
 */
class Test_ge : public Test
{
public:
     // For max_threads_ == 5, we will start the condition variable at
     // the value 9.  When the "last" thread decrements it, the value
     // will be 4 which satisfies the condition.
    Test_ge( int _max_threads )
            : Test(_max_threads,_max_threads*2-1)
        {
            ACE_DEBUG ((LM_INFO, "\n(%P|%t|%T)\tTesting condition_ >= %d\n", max_threads_));
        }

     // Decrement by one...
    void modify(void)
        {
            --condition_;
        }

     // while( value >= max_threads_ ) wait();
    void test(void)
        {
            condition_ >= max_threads_;
        }
};

/* Test Condition::operator<=()
   This time we will increment the condition until it is greater than
   max_threads_.  Again, we have to be careful where we start the
   value and how we increment.
 */
class Test_le : public Test
{
public:
     // I'm starting the value at 1 so that if we increment by one in
     // each thread, the "last" thread (of 5) will set the value to
     // 6.  Since I actually increment by 2, we could start somewhat lower.
    Test_le( int _max_threads )
            : Test( _max_threads, 1 )
        {
            ACE_DEBUG ((LM_INFO, "\n(%P|%t|%T)\tTesting condition_ <= %d\n", max_threads_));
        }

     // Try out Condition::operator+=(int)
     // This will cause the third thread to satisfy the condition.
    void modify(void)
        {
            condition_ += 2;
        }

     // while( value <= max_threads_ ) wait();
    void test(void)
        {
            condition_ <= max_threads_;
        }
};

/* For our final test, we'll go after Condition::operator=(Condition::Compare)
   By deriving from Condition::Compare we can perform any arbitrary
   test on the value of the condition variable.
 */
class Test_fo : public Test
{
public:
     // We'll be using operator*=(int) to increment the condition
     // variable, so we need to start with a non-zero value.
    Test_fo( int _max_threads )
            : Test( _max_threads, 1 )
        {
            ACE_DEBUG ((LM_INFO, "\n(%P|%t|%T)\tTesting condition_ == FunctionObject\n" ));
        }

     // Double the value for each thread that we have.
    void modify(void)
        {
            condition_ *= 2;
        }

     /* Derive our CompareFunction and provide the operator() that
        performs our test.  In this case, we'll compare the value to
        the number 32.
      */
    class CompareFunction : public Condition::Compare
    {
    public:
         // When this returns non-zero, the condition test operator
         // will unblock in each thread.
         // Note that 32 was chosen because 2**5 == 32.  That is, the
         // fifth thread will modify() the value to 32.
        int operator() ( Condition::value_t _value )
            {
                return _value == 32;
            }
    };

     // Create the CompareFunction and wait for the condition variable
     // to reach the state we want.
    void test(void)
        {
            CompareFunction compare;
            condition_ == compare;
        }
};

/* In main() we just instantiate each of the four test objects that we
   created.  After open()ing each, we wait() for it's threads to exit.
 */
int main(int, char **)
{
    Test_ne test_ne(5);
    test_ne.open();
    test_ne.wait();

    Test_ge test_ge(5);
    test_ge.open();
    test_ge.wait();

    Test_le test_le(5);
    test_le.open();
    test_le.wait();

    Test_fo test_fo(5);
    test_fo.open();
    test_fo.wait();

    return(0);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影中文字幕在线观看| www.性欧美| 欧美丰满美乳xxx高潮www| 天天操天天干天天综合网| 欧美大胆一级视频| 91丨九色porny丨蝌蚪| 日本欧美大码aⅴ在线播放| 久久日一线二线三线suv| 日韩中文字幕不卡| 国产精品入口麻豆原神| 这里只有精品电影| 91小视频免费观看| 色偷偷成人一区二区三区91| 国产一区二区三区在线观看免费视频| 日韩美女啊v在线免费观看| 日韩一二三区视频| 欧美熟乱第一页| 成人精品在线视频观看| 精品影视av免费| 偷拍日韩校园综合在线| 美女视频免费一区| 三级久久三级久久久| 丝袜脚交一区二区| 经典三级视频一区| www.色精品| 欧美日韩一级二级三级| 欧洲一区在线电影| 色狠狠一区二区| 91免费版pro下载短视频| 精品视频在线免费看| 欧美大胆一级视频| 亚洲美女免费视频| 最新不卡av在线| 日韩一区精品字幕| 成人免费va视频| 91精品在线免费观看| 国产精品免费aⅴ片在线观看| 亚洲日本欧美天堂| 极品美女销魂一区二区三区免费 | 不卡一区二区三区四区| 黄色日韩网站视频| 黄色日韩网站视频| 91麻豆.com| 久久久久久久久久久久久久久99| 一区二区在线观看视频| 一区二区三区欧美久久| 亚洲青青青在线视频| 老司机精品视频在线| 国产中文字幕精品| 欧美猛男男办公室激情| 91精品欧美福利在线观看| 中文字幕一区二区三区不卡| 综合中文字幕亚洲| 国产一区视频导航| 日韩一区二区三区av| 亚洲激情av在线| 成人黄色片在线观看| 2021久久国产精品不只是精品| 日韩国产精品久久久| 在线观看不卡一区| 亚洲欧美韩国综合色| 成人高清免费在线播放| 久久夜色精品国产噜噜av | 欧美va天堂va视频va在线| 精品对白一区国产伦| 国产精品午夜免费| 国产在线观看一区二区| 欧美成人性战久久| 日韩高清欧美激情| 欧美一区二区日韩| 中文字幕不卡在线观看| 亚洲自拍偷拍网站| 九九久久精品视频| 日韩欧美二区三区| 精品在线一区二区| 久久久无码精品亚洲日韩按摩| 久久99久久99小草精品免视看| 这里是久久伊人| 久久99最新地址| 久久无码av三级| 高清成人免费视频| 777xxx欧美| 蜜桃视频一区二区三区| 欧美不卡视频一区| 国产精品一级片| 91.com在线观看| 青草av.久久免费一区| 色综合天天综合网国产成人综合天 | 久久综合九色综合97_久久久| 久久成人免费日本黄色| 精品国产91乱码一区二区三区 | 亚洲乱码一区二区三区在线观看| 色综合中文字幕| 天天色天天操综合| 精品国产乱码久久久久久蜜臀| 国产一区二区三区| 国产精品嫩草影院av蜜臀| 日本伦理一区二区| 免费在线观看日韩欧美| 久久精品亚洲精品国产欧美 | 亚洲午夜在线视频| 日韩欧美精品在线视频| 国产一区二区不卡老阿姨| 国产精品成人网| 国产成人久久精品77777最新版本| 91精品国产高清一区二区三区| 经典三级视频一区| 亚洲欧洲制服丝袜| 精品久久久久久久久久久久包黑料 | 欧美国产激情二区三区| 色激情天天射综合网| 蜜臂av日日欢夜夜爽一区| 国产亚洲欧美日韩俺去了| 色天使色偷偷av一区二区| 日韩精彩视频在线观看| 国产精品理论片在线观看| 91精品麻豆日日躁夜夜躁| 成人免费av资源| 蜜桃视频一区二区三区在线观看| 综合欧美一区二区三区| 精品毛片乱码1区2区3区| 色婷婷精品久久二区二区蜜臂av | 欧美性生活久久| 国产不卡免费视频| 免费在线一区观看| 亚洲精品欧美专区| 中文字幕不卡在线| 精品动漫一区二区三区在线观看| 欧美午夜片在线看| 91色婷婷久久久久合中文| 久久99国产精品免费| 香蕉av福利精品导航| 日韩一区二区在线观看视频播放| 成人av电影在线观看| 久久国产乱子精品免费女| 亚洲成人你懂的| 怡红院av一区二区三区| 中文乱码免费一区二区| 欧美成人免费网站| 91麻豆精品国产91| 欧美精品第1页| 91福利国产成人精品照片| 成人黄色免费短视频| 国产一区 二区 三区一级| 美女尤物国产一区| 日日摸夜夜添夜夜添精品视频 | 色噜噜狠狠色综合中国| 99视频在线精品| 国产成人亚洲精品青草天美| 精品亚洲免费视频| 裸体一区二区三区| 老司机午夜精品| 狠狠色综合日日| 国产精品一区免费在线观看| 九九**精品视频免费播放| 麻豆成人av在线| 国产一区二区三区四区五区美女| 精品无人码麻豆乱码1区2区| 国产精品资源网| 暴力调教一区二区三区| caoporn国产一区二区| 91在线一区二区三区| 日本欧美一区二区在线观看| 亚洲成av人片一区二区| 日韩电影免费在线观看网站| 看片的网站亚洲| 国产制服丝袜一区| kk眼镜猥琐国模调教系列一区二区 | 国产日产欧产精品推荐色| 欧美亚洲综合色| 在线成人av影院| 亚洲精品在线免费播放| 国产午夜亚洲精品不卡| 国产精品电影一区二区| 亚洲永久精品大片| 男男gaygay亚洲| 成人爱爱电影网址| 欧美性受xxxx黑人xyx| 欧美一级黄色录像| 欧美国产日韩在线观看| 亚洲精品国产视频| 美女一区二区视频| 成人美女视频在线看| 欧美乱妇15p| 国产精品色婷婷久久58| 天堂在线亚洲视频| 成人免费精品视频| 欧美巨大另类极品videosbest| 国产亚洲欧洲997久久综合| 亚洲免费电影在线| 激情综合一区二区三区| 在线精品国精品国产尤物884a| 日韩精品中文字幕在线一区| 国产精品久久久久久久久搜平片| 香蕉久久夜色精品国产使用方法 | 黄色资源网久久资源365| 色婷婷国产精品综合在线观看| 精品国产一区久久| 一区二区三区欧美日韩| 国产成人综合亚洲网站|