I am not able to find any spinlock in Qt library. Does Qt don't have any? How can we implement cross-platform(Win-Linux-Mac) spinlock in Qt?
Asked
Active
Viewed 993 times
1
-
You may use any alomic types. Qt or STL. – Dmitry Sazonov Jan 19 '16 at 12:02
-
1Here's an example: https://gist.github.com/aperezdc/5582452 – JKSH Jan 19 '16 at 12:09
-
There is QLockFile or QSharedMemory, which could be used for this – Sebastian Lange Jan 19 '16 at 12:30
-
erk... may I ask why do you possibly need a spinlock, yet you don't know how to implement one? – peppe Jan 19 '16 at 13:44
-
2Perhaps if you described the problem you are trying to solve (with spinlocks) instead of the solution you are looking for, you might get some better responses. It's been a long time since I have actually needed a true spinlock, usually there are other mechanisms that are more CPU friendly available. – jwernerny Jan 19 '16 at 13:59
-
Why not using a QMutex? See http://stackoverflow.com/questions/5869825/when-should-one-use-a-spinlock-instead-of-mutex – Murphy Jan 19 '16 at 22:03