X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=threads-model.h;h=30acd2deba1f50e27a15d1c2d74a649809cf004a;hb=3f77119600ac3aa246258dec2776056d09f8e4e0;hp=02362100dca410b35f531ef536e2066f85315890;hpb=96bc0872c55ea4a0c1c52f7d5145f3f953226f78;p=model-checker.git diff --git a/threads-model.h b/threads-model.h index 0236210..30acd2d 100644 --- a/threads-model.h +++ b/threads-model.h @@ -13,6 +13,11 @@ #include #include "modeltypes.h" +struct thread_params { + thrd_start_t func; + void *arg; +}; + /** @brief Represents the state of a user Thread */ typedef enum thread_state { /** Thread was just created and hasn't run yet */ @@ -36,7 +41,7 @@ class ModelAction; class Thread { public: Thread(thread_id_t tid); - Thread(thrd_t *t, void (*func)(void *), void *a); + Thread(thrd_t *t, void (*func)(void *), void *a, Thread * parent_thrd = NULL); ~Thread(); void complete(); @@ -90,8 +95,15 @@ public: return wait_list[i]; } + /** @return The pending (next) ModelAction for this Thread + * @see Thread::pending */ ModelAction * get_pending() const { return pending; } + + /** @brief Set the pending (next) ModelAction for this Thread + * @param act The pending ModelAction + * @see Thread::pending */ void set_pending(ModelAction *act) { pending = act; } + /** * Remove one ModelAction from the waiting list * @return The ModelAction that was removed from the waiting list @@ -114,10 +126,22 @@ public: */ private: int create_context(); + + /** @brief The parent Thread which created this Thread */ Thread *parent; + + /** @brief The THREAD_CREATE ModelAction which created this Thread */ ModelAction *creation; + /** + * @brief The next ModelAction to be run by this Thread + * + * This action should be kept updated by the ModelChecker, so that we + * always know what the next ModelAction's memory_order, action type, + * and location are. + */ ModelAction *pending; + void (*start_routine)(void *); void *arg; ucontext_t context;