2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstflock.c,v 1.2 2006-03-23 12:07:12 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)
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);
87 pthread_t child_thread[2];
90 pthread_create(&child_thread[0], 0 /* attr */, run_func, &id1);
91 pthread_create(&child_thread[1], 0 /* attr */, run_func, &id2);
92 pthread_join(child_thread[0], 0);
93 pthread_join(child_thread[1], 0);
98 int main(int argc, char **argv)
100 YAZ_CHECK_INIT(argc, argv);
102 printf("seq=%s\n", seq);
104 /* does not pass.. for bug 529 */
105 YAZ_CHECK(strcmp(seq, "LULULULU") == 0);
112 * indent-tabs-mode: nil
114 * vim: shiftwidth=4 tabstop=8 expandtab