We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5335f6e commit 09b6081Copy full SHA for 09b6081
pthreads/pthread-rwlock.c
@@ -28,6 +28,8 @@ pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
28
29
void *properties[MAX_PROPS];
30
31
+#define MAX_ITER 100
32
+
33
static void
34
millisleep(int msec)
35
{
@@ -89,9 +91,11 @@ writer_thread(void *arg)
89
91
static void *
90
92
reader_thread(void *arg)
93
- int rnd = random() % MAX_PROPS;
- void *val = prop_get(rnd);
94
- printf("got %p for %d\n", val, rnd);
+ for (int i = 0; i < MAX_ITER; i++) {
95
+ int rnd = random() % MAX_PROPS;
96
+ void *val = prop_get(rnd);
97
+ printf("got %p for %d\n", val, rnd);
98
+ }
99
return (NULL);
100
}
101
0 commit comments