Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Threading model questions for Eclipse builder developer
Threading model questions for Eclipse builder developer [message #1803809] Mon, 11 March 2019 10:59 Go to next message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 135
Registered: March 2010
Senior Member
Hello,

I am writing a plugin which includes a builder. I am trying to understand what sort of thread-safety concerns I need to address.

I know that there is a main GUI thread and am also becoming familiar with the "Jobs" facility where it is clear to me that the background task code is running outside the GUI thread.

What I would like to know is when BUILDER code runs during compilation. Specifically my first questions are:


  1. Since building a project shows up in the progress view, I assume that Eclipse compiles code as a "job" outside the GUI thread. Is that accurate?
  2. Is it safe to assume that builders run one-at-a-time in sequence in a single job (work thread) that only has to worry about concurrent GUI thread events, or do I need to worry about multiple builders triggering concurrently (e.g. because in a full clean build where projects A and B have no relation to each other - other than being in the same workspace - might get compiled concurrently in separate work threads?


By the way, is this the right forum for "developer" questions or is it supposed to be mostly a "user" forum? Where would I get more traction discussing this sort of thing?
Re: Threading model questions for Eclipse builder developer [message #1803818 is a reply to message #1803809] Mon, 11 March 2019 13:11 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 865
Registered: January 2012
Senior Member

Hi Alexandros.

The forums are the right place for this kind of question -- the -dev lists are for the developers working on the implementations of components, not the consumers of those components. That said, if you think you've hit a bug in a component, the -dev list is a good place to check.

The key to the builders is to use the Eclipse locking system, based around ISchedulingRule, and knowing when your code is and is not protected by a scheduling rule. If you're building a standalone builder then it's reasonably straightforward, but if you interact with other components, like M2Eclipse, then you need to respect their scheduling rules too. You should obtain these scheduling rules from an IResourceRuleFactory (such as from `IWorkspace#getRuleFactory()`). Be sure to read over and understand WorkspaceJob and WorkspaceModifyOperation.

Be sure to read the workspace modification and advanced resource docs, and "On the Job: The Eclipse Jobs API".

You might find this helper class helpful in diagnosing deadlock issues.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Threading model questions for Eclipse builder developer [message #1803825 is a reply to message #1803818] Mon, 11 March 2019 15:21 Go to previous message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 135
Registered: March 2010
Senior Member
Hello,

Thank you for the very informative links. This is what I was after.
Previous Topic:How can I change the DnDManager behaviour when d'n'd' the parts
Next Topic:Can not change Workspace after upgrade from 4.7 -> 4.9
Goto Forum:
  


Current Time: Mon Dec 09 13:03:40 GMT 2019

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

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

Back to the top