Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [rap-dev] UICallBackManager

Hello

I forgot to attach  my improvements for SyncRunnable#block method

 void block() {
      synchronized( lock ) {
        isLocked = true;
        try {
          lock.wait();
        } catch( final InterruptedException e ) {
          // stop waiting
        }
      }
    }

Thank you,
Igor

-----Original Message-----
From: rap-dev-bounces@xxxxxxxxxxx [mailto:rap-dev-bounces@xxxxxxxxxxx] On
Behalf Of Rudiger Herrmann
Sent: Friday, April 17, 2009 9:32 PM
To: RAP project development-related communication
Subject: Re: [rap-dev] UICallBackManager

Hi Igor,

thanks for the suggestion. Though I don't quite understand how the
while(!isLocked) loop solves the problem.
Could you explain that? Or attach a patch to the bug mentioned before?

Thanks
Rüdiger


mail.apptech.nichost.ru wrote:
> Hello
> 
> Maybe I can do something like this:
> 
> 1) Add boolean field SyncRunnable#isLocked
> 
> 2) Create runLocked method in SyncRunnable:
> 
>     void runLocked() {
>       synchronized( lock ) {
>         while(!isLocked) {
>           try {
>             wait();
>           } catch( InterruptedException e ) {
>             // Do nothing
>           }
>         }
>         isLocked = false;
>       }
>       super.run();
>       synchronized( lock ) {
>         lock.notifyAll();
>       }
>     }
> 
> 3) In UICallBackManager#processNextRunnableInUIThread change 
> runnable.run() to
>     if (runnable instanceof SyncRunnable) {
>       ( ( SyncRunnable )runnable ).runLocked();
>     }
>     else {
>       runnable.run();
>     }
> 
> 
> Whis this changes I can solve my problem (the problem that I 
> described). I tried not to change logic for other types of runnables, 
> so the code listed above is not very clean, but it works.
> 
> Thank you, Igor
> 
> 
> -----Original Message-----
> From: rap-dev-bounces@xxxxxxxxxxx [mailto:rap-dev-bounces@xxxxxxxxxxx] 
> On Behalf Of Rudiger Herrmann
> Sent: Wednesday, April 08, 2009 1:51 PM
> To: RAP project development-related communication
> Subject: Re: [rap-dev] UICallBackManager
> 
> 
> Igor,
> 
> unfortunately fixing this issue isn't that easy. As stated in the 
> comment, synchronizing on runnablesLock may lead to a deadlock.
> See also this bugzilla entry:
>    220981: Fix synchronization Problem in UICallBackManager#addSync()
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=220981
> 
> Cheers,
> Rüdiger
> 
> mail.apptech.nichost.ru wrote:
>> Hello
>>
>> I have a question about UICallBackManager. There are a set of 
>> functions that synchronized with runnablesLock, but not the addSync 
>> function. Is it correct?
>>
>> I reproduced an incorrect situation. I have a thread that locked in 
>> SyncRunnable#block method, but I have an empty 
>> UICallBackManager#runnables list. It seems that the corresponding 
>> SyncRunnable of my thread was removed from 
>> UICallBackManager#runnables before my runnable was blocked in
SyncRunnable#block method.
>>
>> Is it a bug and can I fix this bug by adding synchronization of 
>> runnablesLock? Threre is a comment that notifies about possible 
>> problems with such aproach.
>>
>> Thank you,
>> Igor
>>
>>
>> _______________________________________________
>> rap-dev mailing list
>> rap-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/rap-dev
> _______________________________________________
> rap-dev mailing list
> rap-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/rap-dev
> 
> 
> _______________________________________________
> rap-dev mailing list
> rap-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/rap-dev

_______________________________________________
rap-dev mailing list
rap-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/rap-dev




Back to the top