2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2018 Aleph One Ltd.
6 * Created by Timothy Manning <timothy@yaffs.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include "threading.h"
15 int simulate_power_failure = 0;
17 const struct option long_options[]={
19 {"threads", 1,NULL,'t'}
22 const char short_options[]="ht:";
27 void main_init(int argc, char *argv[])
31 int new_num_of_threads=5;
32 x=(unsigned)time(NULL);
33 printf("seeding srand with: %d\n",x);
36 new_option=getopt_long(argc,argv,short_options,long_options,NULL);
39 printf("-h will print the commands available\n");
40 printf("-t [number] sets the number of threads\n");
42 } else if (new_option=='t') {
43 new_num_of_threads=atoi(optarg);
45 }while (new_option!=-1);
46 number_of_threads(new_num_of_threads);
47 init_counter(new_num_of_threads);
51 int main(int argc, char *argv[])
54 pthread_t threads[get_num_of_threads()];
59 for (x=0;x<get_num_of_threads();x++)
62 output = pthread_create(&threads[x], NULL,thread_function, (void *)x );
64 printf("failed to create thread %d. Error is %d\n",x,output);
70 printf("thread counter: %d ",get_counter(y));
71 for (y=1;y<get_num_of_threads();y++){
72 printf("| %d ",get_counter(y));