Skip to content

Commit 3dee42d

Browse files
committed
Add sleepThread() c++ wrapper
1 parent 5124095 commit 3dee42d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

wrappers/cpp/mpmt/thread.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class Thread final
4646
{
4747
setMainThread();
4848
}
49-
5049
/**
5150
* @brief Returns true if current thread is main.
5251
* @details See the @ref isCurrentThreadMain().
@@ -66,7 +65,6 @@ class Thread final
6665
{
6766
getThreadName(name, size);
6867
}
69-
7068
/**
7169
* @brief Sets current thread name.
7270
* @details See the @ref setThreadName().
@@ -85,7 +83,6 @@ class Thread final
8583
{
8684
setThreadForegroundPriority();
8785
}
88-
8986
/**
9087
* @brief Sets current thread priority to background.
9188
* @details See the @ref setThreadBackgroundPriority().
@@ -95,6 +92,16 @@ class Thread final
9592
setThreadBackgroundPriority();
9693
}
9794

95+
/**
96+
* @brief Blocks the execution of the current thread for a specified time.
97+
* @details See the @ref setThreadBackgroundPriority().
98+
* @param delay thread sleep delay time (in seconds)
99+
*/
100+
static void sleep(double delay) noexcept
101+
{
102+
sleepThread(delay);
103+
}
104+
98105
// Note: for other functions use C++ STD thread.
99106
};
100107

0 commit comments

Comments
 (0)