April White: > I've been going over in my head the 'executing' variable. > > I would remove the 'executing = true' assignment from > SciTEBase::Excecute() and replace > if (!executing && !jobQueue.IsEmpty()) > with > if (!::InterlockedExchange(executing,1) && !jobQueue.IsEmpty()) > > Am I on the right track with this?
Not really the same as it sets executing even if it bails out because the queue is empty. Moving executing inside jobQueue and adding a CanExecute method with appropriate locking may be a better approach although you could just reverse the tests. InterlockedExchange is normally used in code which wants to avoid the overhead of real locking which isn't really required by SciTE. The current calls look like they are there because the developer was used to a style where this is used rather than because it was likely to avoid a real problem. In the longer term, possibly after you have finished this modification, I may try to segregate the tool thread code more from the main code by putting it in its own file and only allowing it to communicate with the SciTE class through jobQueue. Neil _______________________________________________ Scite-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scite-interest
