timerExec problem in dwt-win
torhu
no at spam.invalid
Sun Sep 28 07:23:59 PDT 2008
Frank Benoit wrote:
> torhu schrieb:
>> This test doesn't print "OK" like I think it should, it just prints
>> "ctor called". It seems that timerExec doesn't work when called from
>> other threads than the GUI thread. The SWT docs seem to say that this
>> should work. Am I doing something wrong?
>>
>> When doing the same thing in my real DWT app, I get an "Invalid thread
>> access" exception, but I haven't put an exception handler into the
>> secondary thread in this sample.
>
> You get the same exception also in your example code, but it is not
> catched, so the message got lost.
>
I wonder why it's not caught, since it happens automatically with the
old DWT. I think I tested this a while ago, but I can't quite remember
if it was a DWT-specific problem, or if it happens with Tango without
DWT too.
> You need to wrap your code in the Thread into another
> display.asyncExec( dgRunnable({}));
>
Yeah, I was hoping I could just fire off timerExecs without blocking the
current thread by using syncExec, or having to use asyncExec which is
more complicated. But from rereading the SWT docs, timerExec does
behave correctly in DWT. I'll have to do this another way, then.
More information about the Digitalmars-d-dwt
mailing list