summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/builtin_timezones.c6
-rw-r--r--src/test/icaltm_test.c14
2 files changed, 17 insertions, 3 deletions
diff --git a/src/test/builtin_timezones.c b/src/test/builtin_timezones.c
index 9271bd33..24b56f6d 100644
--- a/src/test/builtin_timezones.c
+++ b/src/test/builtin_timezones.c
@@ -12,7 +12,7 @@
#include <config.h>
#endif
-#ifdef HAVE_PTHREAD_H
+#if ICAL_SYNC_MODE == ICAL_SYNC_MODE_PTHREAD
#include <pthread.h>
#include <assert.h>
#endif
@@ -21,7 +21,7 @@
#include <stdio.h>
-#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD) && defined(HAVE_PTHREAD_CREATE)
+#if ICAL_SYNC_MODE == ICAL_SYNC_MODE_PTHREAD
#define N_THREADS 20
@@ -82,7 +82,7 @@ int main(void)
set_zone_directory("../../zoneinfo");
icaltimezone_set_tzid_prefix("/softwarestudio.org/");
-#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD) && defined(HAVE_PTHREAD_CREATE)
+#if ICAL_SYNC_MODE == ICAL_SYNC_MODE_PTHREAD
test_get_component_threadsafety();
#endif
diff --git a/src/test/icaltm_test.c b/src/test/icaltm_test.c
index 74bea858..e98e7f6a 100644
--- a/src/test/icaltm_test.c
+++ b/src/test/icaltm_test.c
@@ -16,7 +16,9 @@
#include <pthread.h>
+#if ICAL_SYNC_MODE != ICAL_SYNC_MODE_THREADLOCAL
static icaltimezone *zone, *utc;
+#endif
static void *test_tread(void *user_data)
{
@@ -24,6 +26,14 @@ static void *test_tread(void *user_data)
int ii;
_unused(user_data);
+
+#if ICAL_SYNC_MODE == ICAL_SYNC_MODE_THREADLOCAL
+ // In thread-local mode all initialization must be done per thread, so we do it here, rather
+ // than in main().
+ icaltimezone* zone = icaltimezone_get_builtin_timezone("America/New_York");
+ icaltimezone* utc = icaltimezone_get_utc_timezone();
+#endif
+
itt = icaltime_from_string("19710203T040506");
itt.zone = zone;
@@ -39,8 +49,12 @@ int main(void)
pthread_t thread[2];
int ii;
+#if ICAL_SYNC_MODE != ICAL_SYNC_MODE_THREADLOCAL
+ // In thread-local mode all initialization must be done per thread.
+ // In all other modes we do the initialization of built in timezones here.
zone = icaltimezone_get_builtin_timezone("America/New_York");
utc = icaltimezone_get_utc_timezone();
+#endif
for (ii = 0; ii < 2; ii++) {
pthread_create(&thread[ii], NULL, test_tread, NULL);