Ron
October 13th, 2002, 12:55 PM
Mark, first of all get well soon!!!
Secondly thanks for the ideas, I've been watching "tomorrow never dies" and because this is such a trilling ( yeah right ) movie my mind wandered over this problem. I think I have a nice way of keeping compatibility and making a good queue. This is my idea:
I'll keep the current shared memory, this is protected by the semaphore as it is now.
The plugin sends the event to a completely separate window running in a completely separate thread that ONLY processes these events, thus processing should be very quick.
This event collection thread immediately copies the shared memory into a circular buffer ( some depth like 10 or 20 events should be plenty ) and releases the Semaphore ( Currently Girder locks the semaphore if there is an event running already,.. BAAAAAD, so a third incoming event will fail ),
Now the collection thread is ready for the next event.
This will only take a few microseconds,... if it proves insufficient I can always extend it and export some function that directly adds an event to the queue instead of using the windows message passing. Really blazing fast.
If the executing thread is waiting for a new event the collection thread will set an event to wake up the execution thread. The execution thread will also remove old events from the circular buffer.
Of course the circular buffer is protected by a mutex.
This will be the first thing I'll start to work on tomorrow morning.
Does anyone see any fundamental problems with this approach ? If so speak up now or forever hold your peace! :evil:
Note: this will also solve some problems with the antirepeat not working 100% (Dave)
Secondly thanks for the ideas, I've been watching "tomorrow never dies" and because this is such a trilling ( yeah right ) movie my mind wandered over this problem. I think I have a nice way of keeping compatibility and making a good queue. This is my idea:
I'll keep the current shared memory, this is protected by the semaphore as it is now.
The plugin sends the event to a completely separate window running in a completely separate thread that ONLY processes these events, thus processing should be very quick.
This event collection thread immediately copies the shared memory into a circular buffer ( some depth like 10 or 20 events should be plenty ) and releases the Semaphore ( Currently Girder locks the semaphore if there is an event running already,.. BAAAAAD, so a third incoming event will fail ),
Now the collection thread is ready for the next event.
This will only take a few microseconds,... if it proves insufficient I can always extend it and export some function that directly adds an event to the queue instead of using the windows message passing. Really blazing fast.
If the executing thread is waiting for a new event the collection thread will set an event to wake up the execution thread. The execution thread will also remove old events from the circular buffer.
Of course the circular buffer is protected by a mutex.
This will be the first thing I'll start to work on tomorrow morning.
Does anyone see any fundamental problems with this approach ? If so speak up now or forever hold your peace! :evil:
Note: this will also solve some problems with the antirepeat not working 100% (Dave)