I knew that sane is not thread safe, but I thought I'd be OK if I did a 'sane_init ... sane work ... sane_exit', all within a single thread. But alas not.
So, I'm going to have to do a bit of refactoring to solve this problem. The current plan is to:
- Move the sane_init and sane_exit in the main startup/shutdown methods.
- Create a 'command socket' within the main block of the program.
- Isolate sane activity from the current methods that do sane work and replace them with calls into the command socket.
- Use a listening loop on the command socket to dispatch sane work - that will be done within the main part of the program (and not a thread).
No comments:
Post a Comment