Checkpoint

This commit is contained in:
Robin E. R. Davies
2025-07-07 02:30:30 -04:00
parent fddfde9313
commit e7cdd38056
83 changed files with 4733 additions and 214 deletions
+6 -5
View File
@@ -73,6 +73,7 @@ DBusDispatcher::PostHandle DBusDispatcher::PostDelayed(const clock::duration &de
void DBusDispatcher::Run()
{
this->eventFd = eventfd(0, 0);
threadStarted = true;
this->serviceThread = std::thread(
[this]()
{ this->ThreadProc(); });
@@ -169,7 +170,7 @@ void DBusDispatcher::ThreadProc()
int eventTimeout = GetEventTimeoutMs();
if (eventTimeout != -1 && eventTimeout < pollTimeout)
{
pollTimeout = eventTimeout;/*+-*/
pollTimeout = eventTimeout; /*+-*/
}
if (pollTimeout > 250 || pollTimeout == -1)
{
@@ -197,13 +198,13 @@ void DBusDispatcher::ThreadProc()
LogTrace("DBusDispatcher", "ThreadProc", "Service thread terminated.");
}
void DBusDispatcher::Wait()
void DBusDispatcher::WaitForClose()
{
try
{
if (!threadJoined)
if (threadStarted)
{
threadJoined = true;
threadStarted = false;
serviceThread.join();
}
}
@@ -229,7 +230,7 @@ void DBusDispatcher::Stop()
this->stopping = true;
WakeThread();
Wait();
WaitForClose();
}
}
+2 -2
View File
@@ -24,7 +24,7 @@ public:
void Run();
// Stop everything, shutting down gracefully.
void Stop();
void Wait();
void WaitForClose();
bool IsFinished();
// Stop, but don't wait. Suitable for use in a signal handler.
@@ -78,7 +78,7 @@ private:
std::atomic<bool> stopping;
std::vector<CallbackEntry> postedEvents;
bool threadJoined;
bool threadStarted;
std::thread serviceThread;
std::mutex postMutex;
};
+3
View File
@@ -35,6 +35,9 @@ public:
static std::string encode_url_segment(const char*pStart, const char*pEnd, bool isQuerySegment = false);
static std::string encode_url_segment(const std::string &segment, bool isQuerySegment = false) {
return encode_url_segment(segment.c_str(), segment.c_str() + segment.length(), isQuerySegment);
}
static void encode_url_segment(std::ostream&os, const char*pStart, const char *pEnd, bool isQuerySegment = false);
static void encode_url_segment(std::ostream&os, const std::string&segment, bool isQuerySegment = false)
{