Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jhheider committed Mar 5, 2023
1 parent ab2e9f3 commit e3f1734
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions projects/gnu.org/glibc/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ test:
dependencies:
gnu.org/gcc: '*'
script: |
# Putting ourselves in the LD_LIBRARY_PATH breaks literally everything else...
export LD_LIBRARY_PATH=$(echo LD_LIBRARY_PATH | tr ':' '\n' | grep -v {{prefix}} | tr '\n' ':')
test "{{hw.platform}}" = "darwin" && exit 0
case "{{hw.arch}}" in
x86-64) ARCH=x86_64;;
Expand Down
30 changes: 30 additions & 0 deletions projects/gnu.org/glibc/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#define _GNU_SOURCE
#include <assert.h>
#include <gnu/libc-version.h>
#include <stdatomic.h>
#include <stdio.h>
#include <threads.h>

atomic_int acnt;
int cnt;

int f(void* thr_data) {
for(int n = 0; n < 1000; ++n) {
++cnt;
++acnt;
}
return 0;
}

int main(int argc, char **argv) {
/* Basic library version check. */
printf("gnu_get_libc_version() = %s\n", gnu_get_libc_version());

thrd_t thr[10];
for(int n = 0; n < 10; ++n)
thrd_create(&thr[n], f, NULL);
for(int n = 0; n < 10; ++n)
thrd_join(thr[n], NULL);
printf("The atomic counter is %u\n", acnt);
printf("The non-atomic counter is %u\n", cnt);
}

0 comments on commit e3f1734

Please sign in to comment.