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
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
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
Eclipse UserFriend
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.
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
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
Registered: March 2010
Senior Member
Hello,

Thank you for the very informative links. This is what I was after.
Previous Topic:Can not change Workspace after upgrade from 4.7 -> 4.9
Next Topic:problem to export from eclipse 64 to 32 with delta pack
Goto Forum:
  


Current Time: Thu Apr 25 22:59:42 GMT 2024

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

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

Back to the top