I'm trying to use hogCPU() to prevent two tasks writing to the same variable, but every time I call it my NXT hangs completely and I need to remove the battery to get it back again. I've included some sample code that illustrates the bug - not very useful code but it shows what I mean. I've tried using releaseCPU(), abortTimeslice() and EndTimeSlice() (which all seem to be the same thing) but no joy. Any ideas?
If you are going to try the code, link over your USB cable or you will descend into Bluetooth hell.