Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Running into Deadlocks using EMF Transaction API?
Running into Deadlocks using EMF Transaction API? [message #574546] Wed, 12 April 2006 22:43
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi,

If you have been running into deadlocks where multiple threads communicating
synchronously need to access the same editing domain for reading or for
writing, I have committed a bit of new API for this week's M6a build which
may help.

The new TransactionalEditingDomain method

RunnableWithResult createPrivilegedRunnable(Runnable)

allows a thread that owns a transaction to "bless" a Runnable, so that it
may be executed on any other thread while the currently active transaction
is in progress. The thread that executes the resulting privileged runnable
"borrows" the transaction for the duration of the execution.

This allows multiple threads to cooperatively share transactions, as long as
they synchronize themselves appropriately to avoid protocol violations.
Note that, while a privileged runnable is executing one one thread, the
thread that originally owned the transaction has lost access to the editing
domain for the duration, because it temporarily gave up ownership.

A privileged runnable can borrow read-only and read-write transactions,
alike.

A common source of grief is the need for a background thread (such as a
modal context thread), which has an open transaction, needing to call some
other API on the UI thread via Display.syncExec(). When that syncExec'd
code needs a transaction to access the editing domain, deadlock ensues.
Passing a privileged runnable to an API such as Display.syncExec() can
help.

This changed is tracked by
https://bugs.eclipse.org/bugs/show_bug.cgi?id=136156

Cheers,

Christian
Previous Topic:Running into Deadlocks using EMF Transaction API?
Next Topic:Interactive OCL Console Anywhere
Goto Forum:
  


Current Time: Fri Apr 26 20:07:03 GMT 2024

Powered by FUDForum. Page generated in 0.02603 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top