??????????е???

????????????????з??

??????????????????run????????????е?????????д???????????????????????????????????е?close????????run???????????????????е?close????????????????????е??????????????£?

void close()
    {
        lock_guard_t lock(m_mutex);
        m_flag = false;
        m_cond.broadcast();
}

?????????????????????????????????????broadcast?? ??????е?run????????????????????????run?????????????????????????????m_flag ??????????????????????????????????????????????????б??????к?run??????????

??????????????????????е?helloworld???????

class foo_t
{
public:
    void print(int data)
    {
        cout << "helloworld?? data:" <<data << " thread id:"<< ::pthread_self() << endl;
    }
    void print_callback(int data?? void (*callback_)(int))
    {
        callback_(data);
    }
    static void check(int data)
    {
        cout << "helloworld?? data:" <<data << " thread id:"<< ::pthread_self() << endl;
    }
};

//  ?????????????
void test_1()
{
    thread_t thread;
    task_queue_t tq;

    thread.create_thread(task_binder_t::gen(&task_queue_t::run?? &tq)?? 1);

    foo_t foo;
    for (int i = 0; i < 100; ++i)
    {
        cout << "helloworld?? thread id:"<< ::pthread_self() << endl;
        tq.produce(task_binder_t::gen(&foo_t::print?? &foo?? i));
        sleep(1);
    }
    thread.join();
}
int main(int argc?? char* argv[])
{
    test_1();
    return 0;
}

??????????????????????е??????????????????????????????????????????л???????????????????С????????????????????????????????????á?

????????????????з??

??????????????????????????????????????????????????????а???????????ò??????????в?????п??????

???????漸??????????????

?????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????С?????????????????????????????????????????????????м??ɡ?

?????? ??????????е???socket???д??????????????????????????????????????????????У??????socket??????????????????????????У?????????????????????????????socket?????в??????????????????????????????????????