views:

20

answers:

0

As I read into threading, I'm starting to see a lot of really helpful diagrams that look like these:

alt text alt text

I was wondering if any of you know of a repository of such images that describe the functionality of the boost threading objects, idioms, potential pitfalls, etc.

The most helpful diagram that I can envision would look something like this: It would start with minimalistic sample code such as this:

boost::condition someCondition;
boost::mutex someMutex;

void functionForThread1()
{
    while(true)
    {
        boost::mutex::scoped_lock lock(someMutex);
        someCondition.notify_one();
    }
}

void functionForThread2()
{
    boost::mutex::scoped_lock lock(someMutex);
    while(true)
    {
        someCondition.wait(lock);
        cout << "I have been notified!" << endl;
    }

}

The example would then follow with a diagram composed of two columns, one for each thread. Just as in the example figures above, execution time would be represented vertically in the diagram. The code from above would be reprinted in the columns according to when the lines execute.

Do such diagrams exist? And if so, where do I find them?