summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-09-23 19:17:20 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-09-30 17:35:27 +0400
commit1153187a8c6475dbe9290531447f203ebc9bf112 (patch)
tree2e4b1c5043a3097b9f588c9b8112c04a8eb6fb0e /tests
parent4580df04773fe51b0b3e2b5ded47017f265be4c9 (diff)
downloadbdwgc-1153187a8c6475dbe9290531447f203ebc9bf112.tar.gz
Adjust tests code for 'disclaim' feature
Diffstat (limited to 'tests')
-rw-r--r--tests/disclaim_bench.c3
-rw-r--r--tests/disclaim_test.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/tests/disclaim_bench.c b/tests/disclaim_bench.c
index 2bdcaac8..0386ffc9 100644
--- a/tests/disclaim_bench.c
+++ b/tests/disclaim_bench.c
@@ -23,6 +23,7 @@
#include "atomic_ops.h"
#include "gc_disclaim.h"
+// FIXME: skip test if AO_fetch_and_add1 not available
static AO_t free_count = 0;
typedef struct testobj_s *testobj_t;
@@ -31,7 +32,7 @@ struct testobj_s {
int i;
};
-void testobj_finalize(void *obj, void *carg)
+void GC_CALLBACK testobj_finalize(void *obj, void *carg)
{
AO_fetch_and_add1((AO_t *)carg);
assert(((testobj_t)obj)->i++ == 109);
diff --git a/tests/disclaim_test.c b/tests/disclaim_test.c
index 4bd4a1d2..3bb175fc 100644
--- a/tests/disclaim_test.c
+++ b/tests/disclaim_test.c
@@ -32,7 +32,7 @@ struct pair_s {
pair_t cdr;
};
-void pair_dct(void *obj, void *cd)
+void GC_CALLBACK pair_dct(void *obj, void *cd)
{
pair_t p = obj;
int checksum;
@@ -91,6 +91,7 @@ pair_check_rec(pair_t p)
#ifdef GC_PTHREADS
# define THREAD_CNT 6
+# include <pthread.h>
#else
# define THREAD_CNT 1
#endif
@@ -143,7 +144,7 @@ int main(void)
#if THREAD_CNT > 1
printf("Threaded disclaim test.\n");
for (i = 0; i < THREAD_CNT; ++i) {
- int err = GC_pthread_create(&th[i], NULL, test, NULL);
+ int err = pthread_create(&th[i], NULL, test, NULL);
if (err) {
fprintf(stderr, "Failed to create thread # %d: %s\n", i,
strerror(err));
@@ -151,7 +152,7 @@ int main(void)
}
}
for (i = 0; i < THREAD_CNT; ++i) {
- int err = GC_pthread_join(th[i], NULL);
+ int err = pthread_join(th[i], NULL);
if (err) {
fprintf(stderr, "Failed to join thread # %d: %s\n", i,
strerror(err));