Boost logo

Boost :

Subject: [boost] [threads / signals2] Win events replace by boost signals (threadsafe)
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-03-23 04:55:00


I have to change win32 events with something portable so I decided to use

Right now I have something like:

ret = WaitForMultipleObjets{
        case Timeout: something; break;
        case Event1: something; break;
        case Event2: something; break;

and I think that the good idea is to replace this with something like that:

    Execute code from timeout, if event occurs interrupt and execute
    code which is responsible for event handling}

but for test I write this:

boost::signals2::signal<void()> signal;

void SendSignal()
        std::cout << "Send signal";

int main()
        boost::thread t1(SendSignal);

        for (;;)
                std::cout << ".";

        auto c = signal.connect([]()
                std::cout << "Signal receive" << std::endl;

        return 0;

unfortunately this example is not working, what I've done wrong ?

Best regards

Boost list run by bdawes at, gregod at, cpdaniel at, john at