Commit Graph

6 Commits (6571f20e17a4bb63afeac34a57842b3e81d79db8)

Author SHA1 Message Date
Russ Butler 55d74c55ed Fix join and make Thread class thread safe
Add a mutex to the thread object to protect its internal data. Prevent
making OS calls with a thread ID that has been terminated. This thread
ID can be reused by another thread, leading to undefined behavior if it
is used after termination.

Update the function Thread::join to use a semaphore to
determine when the thread finishes. This both avoids polling and
prevents a freed TCB from being accessed.
2016-08-02 21:17:40 -05:00
Christopher Haster fab672a05e Marked thread-spawning constructors as deprecated
Thread-spawning constructors hide errors and may lead to complex
program state when a thread is declared.

The explicit Thread::start member function should be used to spawn
a thread.
2016-06-28 14:33:22 -05:00
Christopher Haster e079c2e0e9 Added support for Callback to Thread lifetime 2016-06-01 12:11:05 -05:00
Christopher Haster 0180125293 Adopt Callback class in rtos Threads 2016-05-31 20:39:39 -05:00
Christopher Haster 1ab7d73805 Added Thread::start and Thread::join for managing lifetime of threads
- Allows threads to started separately from when they are declared,
  avoiding the need to dynamically allocate threads at runtime.
- Allows multiple threads to join without forceful termination. Allowing
  threads to synchronize on cleanup.
2016-05-25 17:23:18 -05:00
Mihail Stoyanov d9734e5a32 Simplify layout:
* /libraries/mbed -> /hal
* /libraries/rtos -> /rtos
2016-05-23 09:13:59 +01:00