~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/concurrency_test.c

  • Committer: arjen at com
  • Date: 2008-08-25 13:26:34 UTC
  • mto: This revision was merged to the branch mainline in revision 371.
  • Revision ID: arjen@lentz.com.au-20080825132634-yh2563i3xvltoavx
Initial mods for making all tests work again. Some tests adapted+added.
List of tests in Makefile now alphabetically sorted, dups removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
  Just a test application for threads.
3
3
  */
4
4
#include "azio.h"
5
 
#include <libdrizzle/libdrizzle.h>
 
5
#include <libdrizzle/drizzle.h>
6
6
#include <mysys/my_getopt.h>
7
7
#include <stdio.h>
8
8
#include <stdlib.h>
87
87
  if (argc > 1)
88
88
    exit(1);
89
89
 
 
90
  if (!(drizzle_thread_safe()))
 
91
      fprintf(stderr, "This application was compiled incorrectly. Please recompile with thread support.\n");
 
92
 
90
93
  srandom(time(NULL));
91
94
 
92
95
  pthread_mutex_init(&counter_mutex, NULL);
212
215
  time_t *timer_length= (time_t *)p;
213
216
  struct timespec abstime;
214
217
 
 
218
  if (drizzle_thread_init())
 
219
  {
 
220
    fprintf(stderr,"%s: drizzle_thread_init() failed.\n",
 
221
            my_progname);
 
222
    exit(1);
 
223
  }
 
224
 
215
225
  /* 
216
226
    We lock around the initial call in case were we in a loop. This 
217
227
    also keeps the value properly syncronized across call threads.
233
243
  timer_alarm= false;
234
244
  pthread_mutex_unlock(&timer_alarm_mutex);
235
245
 
 
246
  drizzle_thread_end();
 
247
 
236
248
  return 0;
237
249
}
238
250
 
244
256
  int error;
245
257
  azio_stream reader_handle;
246
258
 
 
259
  if (drizzle_thread_init())
 
260
  {
 
261
    fprintf(stderr,"%s: drizzle_thread_init() failed.\n", my_progname);
 
262
    exit(1);
 
263
  }
 
264
 
247
265
  if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY|O_BINARY,
248
266
                    context->use_aio)))
249
267
  {
282
300
  pthread_mutex_unlock(&counter_mutex);
283
301
  azclose(&reader_handle);
284
302
 
 
303
  drizzle_thread_end();
 
304
 
285
305
  return NULL;
286
306
}
287
307