Skip to content

Commit e3f1734

Browse files
committed
wip
1 parent ab2e9f3 commit e3f1734

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

projects/gnu.org/glibc/package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ test:
8181
dependencies:
8282
gnu.org/gcc: '*'
8383
script: |
84+
# Putting ourselves in the LD_LIBRARY_PATH breaks literally everything else...
85+
export LD_LIBRARY_PATH=$(echo LD_LIBRARY_PATH | tr ':' '\n' | grep -v {{prefix}} | tr '\n' ':')
8486
test "{{hw.platform}}" = "darwin" && exit 0
8587
case "{{hw.arch}}" in
8688
x86-64) ARCH=x86_64;;

projects/gnu.org/glibc/test.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#define _GNU_SOURCE
2+
#include <assert.h>
3+
#include <gnu/libc-version.h>
4+
#include <stdatomic.h>
5+
#include <stdio.h>
6+
#include <threads.h>
7+
8+
atomic_int acnt;
9+
int cnt;
10+
11+
int f(void* thr_data) {
12+
for(int n = 0; n < 1000; ++n) {
13+
++cnt;
14+
++acnt;
15+
}
16+
return 0;
17+
}
18+
19+
int main(int argc, char **argv) {
20+
/* Basic library version check. */
21+
printf("gnu_get_libc_version() = %s\n", gnu_get_libc_version());
22+
23+
thrd_t thr[10];
24+
for(int n = 0; n < 10; ++n)
25+
thrd_create(&thr[n], f, NULL);
26+
for(int n = 0; n < 10; ++n)
27+
thrd_join(thr[n], NULL);
28+
printf("The atomic counter is %u\n", acnt);
29+
printf("The non-atomic counter is %u\n", cnt);
30+
}

0 commit comments

Comments
 (0)