D28043: [KDevelop] background parser job control (WIP)

René J.V. Bertin noreply at phabricator.kde.org
Sat Mar 14 10:30:13 GMT 2020


rjvbb created this revision.
rjvbb added reviewers: KDevelop, aaronpuchert.
rjvbb added a project: KDevelop.
Herald added a subscriber: kdevelop-devel.
rjvbb requested review of this revision.

REVISION SUMMARY
  As discussed elsewhere, KDevelop doesn't currently provide a means of job control over the background parser, except when parsing a complete project.
  
  This WIP patch introduces the simplest form of such control: a possibility to stop all background parsing processes that are not part of a project (re)parse. This includes documents that were part of such a (re)parse, got parsed, and then were rescheduled to be parsed again.
  
  The underlying approach I used consists of an instance of a proxy/stub job controller (one per background parser instance, of which there is apparently never more than 1 at the moment). This proxy and the BGParser d class keep track of which documents are under control of the proxy so that only those jobs are cancelled at the user's request.
  
  Most of the change is transparent outside of the BackgroundParser implementation (and doesn't cost much as far as I can tell) but I did have to add a new method to that class for client code that already implements its own job control.
  
  Initially I just dequeued all concerned ThreadWeaver jobs but this caused intermittent crashes that looked as if they were caused by a race condition if one of those jobs was actually running. This was addressed by suspending the weaver first, which also means that the running job is allowed to finish first - not ideal but I haven't found a safe way around that yet.
  
  As a side-effect this change also avoids queuing a reparse of a document that is already queued for parsing, which is probably a good thing.
  
  An alternative would be to implement a "cancel all background parsing" action, but this would also need to cancel the project parse jobs and I don't really see how to do that properly without using the current approach and then sending abort commands to all JobController entries.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D28043

AFFECTED FILES
  kdevplatform/language/backgroundparser/backgroundparser.cpp
  kdevplatform/language/backgroundparser/backgroundparser.h
  kdevplatform/language/backgroundparser/parseprojectjob.cpp

To: rjvbb, #kdevelop, aaronpuchert
Cc: kdevelop-devel, develoot, hmitonneau, christiant, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20200314/1114fb30/attachment.html>


More information about the KDevelop-devel mailing list