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.

Apparently you can't call monitor functions directly from inside a cobegin block (which is something I found by trial and error, it's not in the documentation as far as I can see). So I just enclosed the calls in auxiliary functions and it works.