2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstflock.c,v 1.3 2006-03-23 17:32:03 adam Exp $
17 #include <idzebra/flock.h>
24 static char *seqp = seq;
28 static void small_sleep()
36 void *run_func(void *arg)
39 ZebraLockHandle lh = zebra_lock_create(0, "my.LCK");
50 zebra_lock_destroy(lh);
55 DWORD WINAPI ThreadProc(void *p)
61 static void tst_win32()
63 HANDLE handles[NUM_THREADS];
64 DWORD dwThreadId[NUM_THREADS];
65 int i, id[NUM_THREADS];
67 for (i = 0; i<NUM_THREADS; i++)
70 handles[i] = CreateThread(
71 NULL, /* default security attributes */
72 0, /* use default stack size */
73 ThreadProc, /* thread function */
74 pData, /* argument to thread function */
75 0, /* use default creation flags */
76 &dwThreadId[i]); /* returns the thread identifier */
78 WaitForMultipleObjects(NUM_THREADS, handles, TRUE, INFINITE);
85 static void tst_pthread()
87 pthread_t child_thread[NUM_THREADS];
88 int i, id[NUM_THREADS];
89 for (i = 0; i<NUM_THREADS; i++)
90 pthread_create(&child_thread[i], 0 /* attr */, run_func, &id[i]);
92 for (i = 0; i<NUM_THREADS; i++)
93 pthread_join(child_thread[i], 0);
98 int main(int argc, char **argv)
100 YAZ_CHECK_INIT(argc, argv);
105 #if YAZ_POSIX_THREADS
110 printf("seq=%s\n", seq);
112 /* does not pass.. for bug 529 */
113 YAZ_CHECK(strcmp(seq, "LULULULU") == 0);
120 * indent-tabs-mode: nil
122 * vim: shiftwidth=4 tabstop=8 expandtab