Author: Armin Rigo <ar...@tunes.org> Branch: c7-more-segments Changeset: r1037:d9d666092944 Date: 2014-03-16 11:51 +0100 http://bitbucket.org/pypy/stmgc/changeset/d9d666092944/
Log: Trying to use three threads. Buggy still. diff --git a/c7/demo/demo2.c b/c7/demo/demo2.c --- a/c7/demo/demo2.c +++ b/c7/demo/demo2.c @@ -6,6 +6,7 @@ #include "stmgc.h" +#define NTHREADS 3 #define LIST_LENGTH 2000 #define BUNCH 100 @@ -223,7 +224,7 @@ int main(void) { - int status; + int status, i; status = sem_init(&done, 0, 0); assert(status == 0); @@ -233,11 +234,13 @@ setup_list(); - newthread(demo2, (void*)1); - newthread(demo2, (void*)2); + for (i = 1; i <= NTHREADS; i++) { + newthread(demo2, (void*)(uintptr_t)i); + } - status = sem_wait(&done); assert(status == 0); - status = sem_wait(&done); assert(status == 0); + for (i = 1; i <= NTHREADS; i++) { + status = sem_wait(&done); assert(status == 0); + } final_check(); diff --git a/c7/stm/core.c b/c7/stm/core.c --- a/c7/stm/core.c +++ b/c7/stm/core.c @@ -529,6 +529,7 @@ static void abort_with_mutex(void) { + assert(_has_mutex()); dprintf(("~~~ ABORT\n")); switch (STM_PSEGMENT->transaction_state) { diff --git a/c7/stm/core.h b/c7/stm/core.h --- a/c7/stm/core.h +++ b/c7/stm/core.h @@ -15,7 +15,7 @@ #define NB_PAGES (1500*256) // 1500MB -#define NB_SEGMENTS 2 +#define NB_SEGMENTS 3 #define NB_SEGMENTS_MAX 240 /* don't increase NB_SEGMENTS past this */ #define MAP_PAGES_FLAGS (MAP_SHARED | MAP_ANONYMOUS | MAP_NORESERVE) #define NB_NURSERY_PAGES (STM_GC_NURSERY/4) diff --git a/c7/stm/sync.c b/c7/stm/sync.c --- a/c7/stm/sync.c +++ b/c7/stm/sync.c @@ -260,6 +260,7 @@ { assert(_safe_points_requested == false); assert((_safe_points_requested = true, 1)); + assert(_has_mutex()); long i; for (i = 1; i <= NB_SEGMENTS; i++) { _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit