KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
threadutil.h
1/**
2 * ThreadHelper
3 *
4 * Some static helper methods for create a string describing threads.
5 *
6 * Stephen Punak, July 08 2019
7 */
8#ifndef THREADUTIL_H
9#define THREADUTIL_H
10#include <QString>
11#include <QThread>
12#include "kanoopcommon.h"
13
14/**
15 * @brief Static helper methods for obtaining descriptive strings about QThread objects.
16 */
17class KANOOP_EXPORT ThreadUtil
18{
19public:
20 /**
21 * @brief Return a human-readable description of the currently executing thread.
22 * @return String identifying the current thread (e.g. address and name)
23 */
24 static QString currentThreadString();
25
26 /**
27 * @brief Return a human-readable description of a specific thread.
28 * @param thread Pointer to the QThread to describe
29 * @return String identifying the thread (e.g. address and name)
30 */
31 static QString threadString(QThread* thread);
32
33 /**
34 * @brief Spin-wait (busy-loop) for the specified number of microseconds.
35 * @param usecs Duration to wait in microseconds
36 */
37 static inline void spinSleep(uint64_t usecs);
38};
39
40#endif // THREADUTIL_H
ThreadHelper.
Definition threadutil.h:18
static QString currentThreadString()
Return a human-readable description of the currently executing thread.
static QString threadString(QThread *thread)
Return a human-readable description of a specific thread.
static void spinSleep(uint64_t usecs)
Spin-wait (busy-loop) for the specified number of microseconds.