[GNE]New Event System
Brought to you by:
gillius
|
From: Gillius <gi...@ma...> - 2001-12-07 10:26:15
|
I just got through with an 8 hour code-a-thon here working on making a completely new event system. Note that to the user the API to follow is the same. The main difference is now that it WORKS. It is much cleaner now and does a few cool things like: Doesn't crash. Does what it the docs says it does. It accessed by a single thread as is easy to control. Before there was ONE event thread for everything, and events weren't controlled. One thread can call one function and one thread could call another etc. Sometimes three different threads could be in there and it was hard for the user to follow and hard for me to follow. onDisconnect could theoritically be called before onConnect while onDoneWriting was being called and threads sending information while another tries to read at the same time. That is no more. There is one SINGLE thread that maintains an event queue, one thread for each connection. It serializes the events and actually guarantees onConnect always comes once and only once and first and onDisconnect comes only once and only as the very last. This has the additional benefit that GNE can process events for other connections at the same time AND do reading as well. Before almost all events and reading was handled by the same thread. Now it is not. Gillius |