
Adrian Hey wrote:
Oh yes, so you did. Sorry. What alternative would you propose? Something like Keeans thread talking to the rest of the world by channels?
When Keean suggested this I objected that there was still no way to prevent accidental forking of multiple copies of this supposedly unique resource manager thread. (To enforce safety you still need to use oneShot or similar mechanism).
The top level loader controls how many times a device in initialised, and forks the manager thread. The "user" program is not given control until after all drivers are initialised, so there is no chance of the user being able to fork such a thread. Either way the point is moot, as I have shown how to start two copies of the driver even if it is protected with your onShot function (by replacing the MVar module) ... So I am now happy that the two proposals are equivalent. Keean.