The Thread constructor really doesn't need to call thread_current(),
since it will always be called from model-checker context. Clean up the
use of default "parent_thrd" parameter and just pass NULL when we have
no parent.
{
do {
thrd_t user_thread;
- Thread *t = new Thread(&user_thread, &user_main_wrapper, NULL);
+ Thread *t = new Thread(&user_thread, &user_main_wrapper, NULL, NULL);
add_thread(t);
do {
class Thread {
public:
Thread(thread_id_t tid);
- Thread(thrd_t *t, void (*func)(void *), void *a, Thread * parent_thrd = NULL);
+ Thread(thrd_t *t, void (*func)(void *), void *a, Thread *parent);
~Thread();
void complete();
int create_context();
/** @brief The parent Thread which created this Thread */
- Thread *parent;
+ Thread * const parent;
/** @brief The THREAD_CREATE ModelAction which created this Thread */
ModelAction *creation;
* @param func The function that the thread will call.
* @param a The parameter to pass to this function.
*/
-Thread::Thread(thrd_t *t, void (*func)(void *), void *a, Thread * parent_thrd) :
+Thread::Thread(thrd_t *t, void (*func)(void *), void *a, Thread *parent) :
+ parent(parent),
creation(NULL),
pending(NULL),
start_routine(func),
id = model->get_next_id();
user_thread->priv = this;
- parent = parent_thrd ? parent_thrd : thread_current();
}
/** Destructor */