add Thread::TryJoin
Change-Id: Idcd3aee2670a9c17fc38f60e9c07244478b69729
diff --git a/aos/common/util/thread.h b/aos/common/util/thread.h
index 80b45e1..bf90ce4 100644
--- a/aos/common/util/thread.h
+++ b/aos/common/util/thread.h
@@ -23,8 +23,20 @@
void Start();
// Asks the code to stop and then waits until it has done so.
+ // This or TryJoin() (returning true) must be called exactly once for every
+ // instance.
void Join();
+ // If the code has already finished, returns true. Does not block waiting if
+ // it isn't.
+ // Join() must not be called on this instance if this returns true.
+ // This must return true or Join() must be called exactly once for every
+ // instance.
+ bool TryJoin();
+
+ // Asks the code to stop (in preparation for a Join()).
+ void RequestStop();
+
// Waits until the code has stopped. Does not ask it to do so.
void WaitUntilDone();