Re: User events and Timers
What dialogs are shown? Are they all the same class?
Best way I could think of is to setup sometime of global mutex.
During the dialogs constructor, have it lock a mutex, then unlock when it closes.
During your timer function, have it wait for the mutex to become unlocked before proceeding.
Re: User events and Timers
Quote:
Originally Posted by
jnmacd
What dialogs are shown? Are they all the same class?
Best way I could think of is to setup sometime of global mutex.
During the dialogs constructor, have it lock a mutex, then unlock when it closes.
During your timer function, have it wait for the mutex to become unlocked before proceeding.
Yes I had only just come to a similar conclusion. Its very much a multi-threading type problem.
Most dialogs do not have a common class other than CDialog. So it would seem its going to be alot of changes - possibly by making them all inherit a private class or something like that.
Thanks.
Re: User events and Timers
I think I may have found a neat solution for this problem.
The problem being after one a dialog was closed - what follows can be - many database writes enclosed within a transaction.
I understand at each db write the application blocks but continues to process windows messages. Where now it would potentially find a timer message and then excute the event handler for this - which would then go off and read the same db while a transaction is still pending.
The solution, these timer events now just post a unique message in my own queue.
I then only inspect this queue during the application idle loop.
So only a small code change.