Gunnar Dalsnes wrote:
ion@svn.reactos.com wrote:
Dispatching & Queue Rewrite II:
- Rewrote wait code. It is now cleaner, more optimized andfaster. All waiting functions are now clearly differentiated instead of sharing code.
Imo, sharing the wait code is cleaner... (I remember the time i merged the old wait code into one routine, heh)
I admit it's cleaner, but speed is more important, imo. Debate that can go on for ages however :)
These functions
are called up to a dozen times a second, so having dedicatedcode for each of them is a real boost in speed. - Fixed several queue issues, made a dedicated queue wait/wake function (you are not supposed to use KeWaitFor on a queue,
I used KeWaitXxx in the queue impl. because i thought it was good to have the wait code in one place only. Thou others find speed more important:-D
This introduces hacks into KeWaitXxx (remember != WrQueue?? :P) and also, if you look inside a checked build of NT, you will find ASSERT(Header->Type != QueueObject) inside KeWaitXxx so that really made me unshare the code :)
Now that these changes are in, I have rewritten thread termination (based on Windows Internals Chapter 11) and thread reaping to use hypercrtical work queues. The code for the latter is much simpler/smaller and also quite faster, since the OS manages everything. Termination also works MUCH better, gets rid of the "terminate type" hacks that were added, and also flushes/delivers all APCs, timers and mutants (we only flushed mutants!). Windows Internals described the process in line-by-line pseudo-code so it was a great help.
I should commit that tonight.
Best regards, Alex Ionescu