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 09b6081 commit ec4b091Copy full SHA for ec4b091
pthreads/pthread-rwlock-limit.c
@@ -1,5 +1,6 @@
1
/*
2
- * Find out the lock count limit on your system.
+ * Find out the lock count limit on your system, assuming it is less than
3
+ * ULONG_MAX.
4
*/
5
6
#define _XOPEN_SOURCE 700
@@ -10,19 +11,16 @@
10
11
#include <stdio.h>
12
#include <stdlib.h>
13
#include <string.h>
14
+#include <limits.h>
15
16
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
17
18
int
19
main(int argc, char *argv[])
20
{
- size_t numlocks;
21
+ size_t numlocks = ULONG_MAX;
22
int e;
23
- if (argc != 2)
- errx(1, "usage: %s num_locks", argv[0]);
24
-
25
- numlocks = strtoll(argv[1], NULL, 10);
26
printf("will try: %zu\n", numlocks);
27
28
for (size_t i = 0; i < numlocks; i++) {
0 commit comments