> So, after much debugging... Always use initLock on your locks. Don't ever 
> forget it otherwise the lock will "work" without actually doing what it's 
> supposed to. You might also need deinitLock then.

Oops, sorry I forgot that I'd changed that too. Yes, definitely init them (and 
conds as well) as uninitialized locks may have strange undefined behaviors.

> In this way I am not needing to track state, because tryRecv does the 
> tracking of finished or not finished for me, mostly because the last thing a 
> thread does is send 'Ready' into the channel when it's done with its work. 
> I'm apparently blind to my own code by now so if this is not what I've 
> written in code, then please tell me.

You're sort of correct here. Though you'd likely need to increment `workID` 
count when submitting a task and not after checking `tryRecv`. There's many 
other ways, but currently you're increment and checking `workID` after 
receiving a result, which won't be deterministic.

Reply via email to