File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 81
81
dependencies :
82
82
gnu.org/gcc : ' *'
83
83
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' ':')
84
86
test "{{hw.platform}}" = "darwin" && exit 0
85
87
case "{{hw.arch}}" in
86
88
x86-64) ARCH=x86_64;;
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments