MCPcopy Create free account
hub / github.com/KDE/kdevelop / TryLockThread

Class TryLockThread

kdevplatform/util/tests/test_foregroundlock.cpp:25–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23//BEGIN Helper Threads
24
25class TryLockThread : public QThread
26{
27 Q_OBJECT
28
29public:
30 void run() override
31 {
32 ForegroundLock lock(false);
33 auto* randomGenerator = QRandomGenerator::global();
34 for (int i = 0; i < 1000; ++i) {
35 if (lock.tryLock()) {
36 lock.unlock();
37 }
38 QThread::usleep(randomGenerator->bounded(20));
39 }
40 }

Callers

nothing calls this directly

Calls 3

tryLockMethod · 0.80
runFunction · 0.50
unlockMethod · 0.45

Tested by

no test coverage detected