Author: Remi Meier
Branch: c7
Changeset: r698:738662da75b3
Date: 2014-01-31 14:18 +0100
http://bitbucket.org/pypy/stmgc/changeset/738662da75b3/
Log: update demo2
diff --git a/c7/Makefile b/c7/Makefile
--- a/c7/Makefile
+++ b/c7/Makefile
@@ -14,9 +14,9 @@
rm -f $(BUILD_EXE) $(DEBUG_EXE) $(RELEASE_EXE)
-H_FILES = core.h list.h pagecopy.h reader_writer_lock.h stmsync.h pages.h
nursery.h
+H_FILES = core.h list.h pagecopy.h reader_writer_lock.h stmsync.h pages.h
nursery.h largemalloc.h
-C_FILES = core.c list.c pagecopy.c reader_writer_lock.c stmsync.c pages.c
nursery.c
+C_FILES = core.c list.c pagecopy.c reader_writer_lock.c stmsync.c pages.c
nursery.c largemalloc.c
DEBUG = -g
diff --git a/c7/demo2.c b/c7/demo2.c
--- a/c7/demo2.c
+++ b/c7/demo2.c
@@ -58,8 +58,8 @@
stm_read((objptr_t)r_n);
sum += r_n->value;
- _stm_start_safe_point();
- _stm_stop_safe_point();
+ _stm_start_safe_point(0);
+ _stm_stop_safe_point(0);
if (prev >= r_n->value) {
stm_stop_transaction();
return -1;
@@ -109,8 +109,8 @@
current->next = next->next;
next->next = current;
- _stm_start_safe_point();
- _stm_stop_safe_point();
+ _stm_start_safe_point(0);
+ _stm_stop_safe_point(0);
}
prev = current;
}
@@ -163,9 +163,12 @@
w_prev = w_newnode;
}
+ _stm_minor_collect(); /* hack.. */
+ global_chained_list = (nodeptr_t)stm_pop_root();
+
stm_stop_transaction();
- global_chained_list = (nodeptr_t)stm_pop_root();
+
printf("setup ok\n");
}
@@ -182,7 +185,7 @@
int status;
if (arg != NULL) {
/* we still need to initialize */
- stm_setup_thread();
+ stm_setup_pthread();
sem_post(&initialized);
status = sem_wait(&go);
assert(status == 0);
@@ -195,7 +198,9 @@
if (arg != NULL) {
status = sem_post(&done);
assert(status == 0);
+ stm_teardown_pthread();
}
+
return NULL;
}
@@ -208,9 +213,10 @@
sum = check_sorted();
// little Gauss:
- assert(sum == (1 + LIST_LENGTH) * (LIST_LENGTH / 2));
-
- printf("check ok\n");
+ if (sum == (1 + LIST_LENGTH) * (LIST_LENGTH / 2))
+ printf("check ok\n");
+ else
+ printf("check ERROR\n");
}
@@ -236,7 +242,7 @@
assert(status == 0);
stm_setup();
- stm_setup_thread();
+ stm_setup_pthread();
newthread(demo2, (void*)1);
@@ -252,8 +258,11 @@
status = sem_wait(&done);
assert(status == 0);
-
+
final_check();
+ stm_teardown_pthread();
+ stm_teardown();
+
return 0;
}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit