This is their website.
In case it helps, if the main is changed from:
main()
{
cobegin
{
method1();
method2();
}
} // main
to:
main()
{
method1();
method2();
} // main
Then it outputs the 'expected' result (and the value in the init block initializes the variable properly in this case). I think this proves the monitor's code right. There could be some interference between cobegin and monitor.
A monitor is a block so that functions on it will only execute one at a time, basically. Ideal for mutual exclusion problems.
A cobegin a block whose functions will be executed concurrently. For example, you don't know which of the functions will be executed first.
Calling monitor functions inside a cobegin block, I am just trying to make a program where any of the monitor functions may be called first, but only one is running at a time.