D16218: [KDevelop/Core]: safe signal-handler implementation (WIP)
Aaron Puchert
noreply at phabricator.kde.org
Thu Oct 18 00:55:45 BST 2018
aaronpuchert added a comment.
In D16218#344435 <https://phabricator.kde.org/D16218#344435>, @rjvbb wrote:
> > At least `std::atomic<bool>` is lock-free on all relevant architectures. (I'm aware that the standard doesn't guarantee it, probably because of some embedded architectures.
>
> But is it always lock-free on the relevant architectures? Or rather:
>
> - what determines if the type is lock-free
> - what are "the relevant architectures"?
This is determined by hardware support. With relevant architectures I meant architectures on which Qt/KDE applications can run, like x86, PPC, ARM. These all have lock-free `std::atomic<bool>`, as far as I know. I guess you can also use `std::atomic_flag`, which is guaranteed to be lock-free, and should offer enough functionality for our use case.
> Either way, can a signal handler really be called in the middle of an assignment (to an atomic variable)? If not, then only 1 instance will get access to the inside of the if, no?
Not in the middle of an assignment, but between the read in `if (!handlingSignal)` and the write `handlingSignal = 1` it can be interrupted. That's not atomic.
REPOSITORY
R32 KDevelop
REVISION DETAIL
https://phabricator.kde.org/D16218
To: rjvbb, #kdevelop, kfunk
Cc: aaronpuchert, brauch, kfunk, arrowd, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20181017/23dbbc81/attachment-0001.html>
More information about the KDevelop-devel
mailing list