nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o \
datarace.o impatomic.o cmodelint.o \
snapshot.o malloc.o mymemory.o common.o mutex.o promise.o conditionvariable.o \
- context.o execution.o libannotate.o
+ context.o execution.o libannotate.o pthread.o
CPPFLAGS += -Iinclude -I.
LDFLAGS := -ldl -lrt -rdynamic
ctags -R
PHONY += tests
-tests: $(LIB_SO) # $(MAKE) -C $(TESTS_DIR)
+tests: $(LIB_SO)
+ $(MAKE) -C $(TESTS_DIR)
BENCH_DIR := benchmarks
break;
}
} else if (act->get_type() == THREAD_CREATE || \
- act->get_type() == PTHREAD_CREATE || \ // WL
act->get_type() == THREAD_START || \
act->get_type() == THREAD_FINISH) {
t = th;
has_next = next_execution();
i++;
- } while (i<1); // while (has_next);
+ } while (i<100); // while (has_next);
execution->fixup_release_sequences();
#include "context.h"
#include "params.h"
+#include <map>
+
/* Forward declaration */
class Node;
class NodeStack;
void add_trace_analysis(TraceAnalysis *a) { trace_analyses.push_back(a); }
void set_inspect_plugin(TraceAnalysis *a) { inspect_plugin=a; }
MEMALLOC
+ std::map<pthread_t, ModelAction*> pthread_map;
private:
/** Flag indicates whether to restart the model checker. */
bool restart_flag;
Thread(thread_id_t tid);
Thread(thread_id_t tid, thrd_t *t, void (*func)(void *), void *a, Thread *parent);
Thread(thread_id_t tid, thrd_t *t, void *(*func)(void *), void *a, Thread *parent);
+
~Thread();
void complete();
void (*start_routine)(void *);
void *(*pstart_routine)(void *);
+
void *arg;
ucontext_t context;
void *stack;
model->switch_to_master(new ModelAction(THREAD_START, std::memory_order_seq_cst, curr_thread));
/* Call the actual thread function */
- if ( !curr_thread->start_routine )
- curr_thread->start_routine(curr_thread->arg);
- else
- curr_thread->pstart_routine(curr_thread->arg);
+ curr_thread->start_routine(curr_thread->arg);
/* Finish thread properly */
model->switch_to_master(new ModelAction(THREAD_FINISH, std::memory_order_seq_cst, curr_thread));
}
if (ret)
model_print("Error in create_context\n");
- user_thread->priv = this;
+ // user_thread->priv = this; // WL
}
-/**
- * to be modified
- * Construct a new thread for pthread_create.
+/**
+ * Construct a new thread for pthread.
* @param t The thread identifier of the newly created thread.
* @param func The function that the thread will call.
* @param a The parameter to pass to this function.
*/
-Thread::Thread(thread_id_t tid, thrd_t *t, void* (*func)(void *), void *a, Thread *parent) :
+Thread::Thread(thread_id_t tid, thrd_t *t, void *(*func)(void *), void *a, Thread *parent) :
parent(parent),
creation(NULL),
pending(NULL),
ret = create_context();
if (ret)
model_print("Error in create_context\n");
-
- user_thread->priv = this;
}
+
/** Destructor */
Thread::~Thread()
{