#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;
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);
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;
#ifdef GC_PTHREADS
# define THREAD_CNT 6
+# include <pthread.h>
#else
# define THREAD_CNT 1
#endif
#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));
}
}
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));