libthreads: use model-checker's thread ID assignment
authorBrian Norris <banorris@uci.edu>
Tue, 13 Mar 2012 06:08:12 +0000 (23:08 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 13 Mar 2012 06:08:12 +0000 (23:08 -0700)
libthreads.c

index 6a549d412893daf7b896d72460a64c158af61581..ff51b6a6519e8b328eb0b2853c6e32f97aeb6cae 100644 (file)
@@ -47,6 +47,7 @@ static int create_context(struct thread *t)
 static int create_initial_thread(struct thread *t)
 {
        memset(t, 0, sizeof(*t));
+       model_checker_assign_id(t);
        return create_context(t);
 }
 
@@ -101,13 +102,12 @@ static void thread_wait_finish(void)
  */
 int thread_create(struct thread *t, void (*start_routine), void *arg)
 {
-       static int created = 1;
        int ret = 0;
 
        DBG();
 
        memset(t, 0, sizeof(*t));
-       t->index = created++;
+       model_checker_assign_id(t);
        DEBUG("create thread %d\n", t->index);
 
        t->start_routine = start_routine;