bugfix - add stl-model.h wrappers, to provide more control over STL
[c11tester.git] / threads-model.h
index fd0314ad6b9fa34ac5a42c0fd9cfd94f6f552753..e77e80cc71de39663fd4078307c7c2220fee68a6 100644 (file)
@@ -7,11 +7,11 @@
 
 #include <ucontext.h>
 #include <stdint.h>
 
 #include <ucontext.h>
 #include <stdint.h>
-#include <vector>
 
 #include "mymemory.h"
 #include <threads.h>
 #include "modeltypes.h"
 
 #include "mymemory.h"
 #include <threads.h>
 #include "modeltypes.h"
+#include "stl-model.h"
 
 struct thread_params {
        thrd_start_t func;
 
 struct thread_params {
        thrd_start_t func;
@@ -41,7 +41,7 @@ class ModelAction;
 class Thread {
 public:
        Thread(thread_id_t tid);
 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);
        ~Thread();
        void complete();
 
        ~Thread();
        void complete();
 
@@ -104,6 +104,8 @@ public:
         *  @see Thread::pending */
        void set_pending(ModelAction *act) { pending = act; }
 
         *  @see Thread::pending */
        void set_pending(ModelAction *act) { pending = act; }
 
+       Thread * waiting_on() const;
+
        /**
         * Remove one ModelAction from the waiting list
         * @return The ModelAction that was removed from the waiting list
        /**
         * Remove one ModelAction from the waiting list
         * @return The ModelAction that was removed from the waiting list
@@ -128,7 +130,7 @@ private:
        int create_context();
 
        /** @brief The parent Thread which created this Thread */
        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;
 
        /** @brief The THREAD_CREATE ModelAction which created this Thread */
        ModelAction *creation;
@@ -155,7 +157,7 @@ private:
         * list is used for thread joins, where another Thread waits for this
         * Thread to complete
         */
         * list is used for thread joins, where another Thread waits for this
         * Thread to complete
         */
-       std::vector< ModelAction *, SnapshotAlloc<ModelAction *> > wait_list;
+       SnapVector<ModelAction *> wait_list;
 
        /**
         * The value returned by the last action in this thread
 
        /**
         * The value returned by the last action in this thread