<table><tr><td style="">rjvbb marked an inline comment as done.<br />rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7995" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Almost guilty as charged: I tend to confound reentrant and thread-safe.<br />
You're right of course, if KDW isn't thread-safe itself (and it looks like it probably isn't) there's no getting around using a mutex, but that mutex can still be inside KDW itself.</p>

<p>You probably noticed that I'm using a single mutex like a CriticalSection so that only 1 thread can add entries to any KDW instance in a given session. Initially that was because KDW uses a single QFileSystemWatcher instance behind the scenes, but it might also help avoiding other problems of the kind you evoke. I'm not sure why I didn't do this for the removeDir method too (it's a lot less likely to be called in a highly parallel fashion, of course).</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>I mean, what happens when an inotify event comes in - where is that being handled? Who guarantees that this is not going to get run in parallel to code we protect by our own mutex?</p></blockquote>

<p>I would hope that the dirty and deleted signals are delivered to the thread that connected to them, as Qt promises (I seem to recall :)). In itself that shouldn't be a problem, a change event can also come in while we're adding a directory on the same thread that handles the change events. The existing mutex should kick in if a change event leads to adding a new dir or removing one.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7995" rel="noreferrer">https://phabricator.kde.org/D7995</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, mwolff<br /><strong>Cc: </strong>dfaure, mwolff, brauch, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger<br /></div>