Boost logo

Boost :

Subject: Re: [boost] [context review] Performance questions
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2012-01-09 13:54:50

2) Can we use contexts like condition variables? Can we make something
like this:

struct task{
   // Implementanion

std::deque<task> g_tasks;
continuation g_cont;
boost::thread::mutex g_mutex;

// Executes ready tasks
void thread_1() { // This function will be run in thread #1
    while(1) {
        scoped_lock lock(g_mutex);
        if (g_tasks.empty()) {
        } else {
            auto t = g_tasks.front();


// Generate tasks
void threads_2_n() { // This function will be run in threads #2, #3 ...
    while(1) {
        // Generating task t
        task t;

        scoped_lock lock(g_mutex);

Will there be some performance gains, because there is no more system
calls for condition variables?

If answer is yes for 2), then it is a killer feature and I will vote
YES and write a more detailed review.

P.S.: Sorry for two mails, instead of one.

Best regards,
Antony Polukhin

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