yaffs Moving timothy_tests and updating the makefiles to work with the new test-framework
[yaffs2.git] / direct / test-framework / timothy_tests / threading / test_b.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2011 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Timothy Manning <timothy@yaffs.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include "test_b.h"
15
16 void test_b(void *x)
17 {
18         struct bovver_context *bc = (struct bovver_context *)x;
19         int n = rand() % 20;
20         
21         bc->cycle++;
22
23         if(!bc->dirH)
24                 bc->dirH = yaffs_opendir(bc->baseDir);
25
26         if(!bc->dirH)
27                 return;
28
29         if(n == 0){
30                 yaffs_closedir(bc->dirH);
31                 bc->dirH = NULL;
32         } else {
33                 while(n > 1){
34                         n--;
35                         yaffs_readdir(bc->dirH);
36                 }
37         }
38 }
39