summaryrefslogtreecommitdiff
path: root/src/test/icaltm_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/icaltm_test.c')
-rw-r--r--src/test/icaltm_test.c14
1 files changed, 14 insertions, 0 deletions
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);