Open naveenvhegde opened 9 years ago
I don't think I understand your issue, sorry.
Hi,
i debugged the receiver code a bit, what i understand from that code is.
one main problem i noticed with this, while main thread waiting for next message (blocking sempare.acquire() call), if i issue a sigint, main thread will not recieve that signal because it is waiting on the blocking call. program will not handle ^C (Ctrl + C). i have to issue kill -9 to stop the process.
the alternative solution will be, instead of semaphore, you can use threading.Condition along with the lock.
Please let me know if you think otherwise.
I have not looked into threading.Condition
and condition.wait()
but this sounds like busy waiting for me, more like a polling solution.
Which might introduce higher CPU usage again. (Thats what the whole queue stuff is for in the first place)
I am currently a bit busy so I can't test anything, and don't have the time to read about that in the docs. Maybe next week I might get time to look into that.
I think it should be conditional wait than semaphore.
If signal is issued, the program will come out and handle the signal only after another message is received..