2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstflock.c,v 1.6 2006-05-10 08:13:46 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 */
79 WaitForMultipleObjects(NUM_THREADS, handles, TRUE, INFINITE);
84 static void tst_pthread()
86 pthread_t child_thread[NUM_THREADS];
87 int i, id[NUM_THREADS];
88 for (i = 0; i<NUM_THREADS; i++)
89 pthread_create(&child_thread[i], 0 /* attr */, run_func, &id[i]);
91 for (i = 0; i<NUM_THREADS; i++)
92 pthread_join(child_thread[i], 0);
96 int main(int argc, char **argv)
98 YAZ_CHECK_INIT(argc, argv);
103 #if YAZ_POSIX_THREADS
108 printf("seq=%s\n", seq);
110 /* does not pass.. for bug 529 */
111 YAZ_CHECK(strcmp(seq, "LULULULU") == 0);
120 * indent-tabs-mode: nil
122 * vim: shiftwidth=4 tabstop=8 expandtab