X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=threads.h;h=ed9cbfed118a20561f271aaace5acc67f5b47f6e;hb=85c090982c2a8dd6e236aa8f3d0a79f974ab9603;hp=a97a04c704449963981fe443a711c64abc716fb3;hpb=2ebb0b5a772c0bc5366c41c4980f3fd06f8081ae;p=model-checker.git diff --git a/threads.h b/threads.h index a97a04c..ed9cbfe 100644 --- a/threads.h +++ b/threads.h @@ -41,6 +41,21 @@ public: void set_creation(ModelAction *act) { creation = act; } ModelAction * get_creation() { return creation; } + /** + * Set a return value for the last action in this thread (e.g., for an + * atomic read). + * @param value The value to return + */ + void set_return_value(int value) { last_action_val = value; } + + /** + * Retrieve a return value for the last action in this thread. Used, + * for instance, for an atomic read to return the 'read' value. Should + * be called from a user context. + * @return The value 'returned' by the action + */ + int get_return_value() { return last_action_val; } + friend void thread_startup(); SNAPSHOTALLOC @@ -56,6 +71,13 @@ private: thrd_t *user_thread; thread_id_t id; thread_state state; + + /** + * The value returned by the last action in this thread + * @see Thread::set_return_value() + * @see Thread::get_return_value() + */ + int last_action_val; }; Thread * thread_current();