Subversion Repositories HelenOS

Rev

Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3386 Rev 4263
Line 33... Line 33...
33
#include <proc/thread.h>
33
#include <proc/thread.h>
34
 
34
 
35
#include <synch/waitq.h>
35
#include <synch/waitq.h>
36
#include <synch/rwlock.h>
36
#include <synch/rwlock.h>
37
 
37
 
38
#define READERS     50
38
#define READERS  50
39
#define WRITERS     50
39
#define WRITERS  50
40
 
40
 
41
static rwlock_t rwlock;
41
static rwlock_t rwlock;
42
 
42
 
43
char * test_rwlock1(bool quiet)
43
char *test_rwlock1(void)
44
{
44
{
45
    rwlock_initialize(&rwlock);
45
    rwlock_initialize(&rwlock);
46
 
46
   
47
    rwlock_write_lock(&rwlock);
47
    rwlock_write_lock(&rwlock);
48
    rwlock_write_unlock(&rwlock);  
48
    rwlock_write_unlock(&rwlock);
49
 
49
   
50
    rwlock_read_lock(&rwlock);
50
    rwlock_read_lock(&rwlock);
51
    rwlock_read_lock(&rwlock); 
-
 
52
    rwlock_read_lock(&rwlock);
51
    rwlock_read_lock(&rwlock);
53
    rwlock_read_lock(&rwlock);
52
    rwlock_read_lock(&rwlock);
54
    rwlock_read_lock(&rwlock);
53
    rwlock_read_lock(&rwlock);
-
 
54
    rwlock_read_lock(&rwlock);
55
 
55
   
-
 
56
    rwlock_read_unlock(&rwlock);
56
    rwlock_read_unlock(&rwlock);
57
    rwlock_read_unlock(&rwlock);
57
    rwlock_read_unlock(&rwlock);   
-
 
58
    rwlock_read_unlock(&rwlock);
58
    rwlock_read_unlock(&rwlock);
59
    rwlock_read_unlock(&rwlock);
59
    rwlock_read_unlock(&rwlock);
60
    rwlock_read_unlock(&rwlock);
60
    rwlock_read_unlock(&rwlock);
61
   
61
   
62
    rwlock_write_lock(&rwlock);
62
    rwlock_write_lock(&rwlock);
63
    rwlock_write_unlock(&rwlock);  
63
    rwlock_write_unlock(&rwlock);
64
 
64
   
65
    rwlock_read_lock(&rwlock);
65
    rwlock_read_lock(&rwlock);
66
    rwlock_read_unlock(&rwlock);
66
    rwlock_read_unlock(&rwlock);
67
 
67
   
68
    rwlock_write_lock(&rwlock);
68
    rwlock_write_lock(&rwlock);
69
    rwlock_write_unlock(&rwlock);  
69
    rwlock_write_unlock(&rwlock);
70
 
70
   
71
    rwlock_read_lock(&rwlock);
71
    rwlock_read_lock(&rwlock);
72
    rwlock_read_unlock(&rwlock);
72
    rwlock_read_unlock(&rwlock);
73
   
73
   
74
    return NULL;
74
    return NULL;
75
}
75
}