version 4.0.0_alpha

in almost all methods removed timeouts in milliseconds, replaced to PISystemTime
PITimer rewrite, remove internal impl, now only thread implementation, API similar to PIThread
PITimer API no longer pass void*
PIPeer, PIConnection improved stability on reinit and exit
PISystemTime new methods
pisd now exit without hanging
This commit is contained in:
2024-07-30 14:18:02 +03:00
parent f07c9cbce8
commit 1c7fc39b6c
58 changed files with 677 additions and 1191 deletions

View File

@@ -26,7 +26,8 @@
#ifndef PICONDITIONVAR_H
#define PICONDITIONVAR_H
#include "pithread.h"
#include "pimutex.h"
#include "pisystemtime.h"
/**
@@ -87,18 +88,18 @@ public:
/**
* \brief see waitFor(PIMutex &, int, const std::function<bool()>&)
*/
virtual bool waitFor(PIMutex & lk, int timeoutMs);
virtual bool waitFor(PIMutex & lk, PISystemTime timeout);
/**
* \brief Wait for timeout or until notified
*
* The execution of the current thread (which shall have locked with lk method PIMutex::lock()) is blocked
* during timeoutMs, or until notified (if the latter happens first).
* during timeout, or until notified (if the latter happens first).
*
* At the moment of blocking the thread, the function automatically calls lk.lock() (PIMutex::lock()), allowing
* other locked threads to continue.
*
* Once notified or once timeoutMs has passed, the function unblocks and calls lk.unlock() (PIMutex::unlock()),
* Once notified or once timeout has passed, the function unblocks and calls lk.unlock() (PIMutex::unlock()),
* leaving lk in the same state as when the function was called. Then the function returns (notice that this last
* mutex locking may block again the thread before returning).
*
@@ -114,7 +115,7 @@ public:
* as a bool. This is called repeatedly until it evaluates to true.
* @return false if timeout reached or true if wakeup condition is true
*/
virtual bool waitFor(PIMutex & lk, int timeoutMs, const std::function<bool()> & condition);
virtual bool waitFor(PIMutex & lk, PISystemTime timeout, const std::function<bool()> & condition);
private:
PRIVATE_DECLARATION(PIP_EXPORT)