From ead9b8be325bdadb6b2a4e2a3b22dd34d7df8e4d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 18 Feb 2020 08:41:41 -0800 Subject: Renamed Bu::Thread::stop to Bu::Thread::forceStop. This wound up biting me, stop wasn't implemented in one child class and it was force-stopping it. Stop isn't usually implemented like this in threadding classes, and this should be no exception. I'm still exposing the posix threads stop functionality, but it really shouldn't even be used. This may break some things, but if it does, they probably weren't working correctly anyway. Sorry. --- src/stable/thread.cpp | 2 +- src/stable/thread.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/stable') diff --git a/src/stable/thread.cpp b/src/stable/thread.cpp index 98f08ec..7d362e9 100644 --- a/src/stable/thread.cpp +++ b/src/stable/thread.cpp @@ -51,7 +51,7 @@ bool Bu::Thread::start() return true; } -bool Bu::Thread::stop() +bool Bu::Thread::forceStop() { pthread_cancel( ptHandle ); diff --git a/src/stable/thread.h b/src/stable/thread.h index 294c250..5174d1c 100644 --- a/src/stable/thread.h +++ b/src/stable/thread.h @@ -79,11 +79,16 @@ namespace Bu * probably create a memory leak type of situation. Instead of stop, * consider using cancel, which can be handled by the running thread in * a graceful manner. + * + * NOTE: This was called stop(), but that was too ambiguous and common + * of a name to implement in subclasses. The functionality was not + * obvious, and this was sometimes used in place of a clean stopping + * routine. *@returns True if the thread was stopped, false otherwise. When this * function returns the thread may not have stopped, to ensure that the * thread has really stopped, call join. */ - bool stop(); + bool forceStop(); /** * Join the thread in action. This function performs what is commonly -- cgit v1.2.3