source: tests/concurrency/pthread/pthread_attr_test.cfa@ e1358c0

Last change on this file since e1358c0 was d923fca, checked in by Andrew Beach <ajbeach@…>, 7 months ago

Clean-up the warnings of the concurrency tests. A lot of little test level fixes, the most interesting repeated one is some formally redundent fallthough statements. pthread_attr_test had to be rewritten because of library restrictions. Changed some types so they would always be pointer sized. There was a library change, there was a function that could not be implemented; I trust that it is included for a reason so I just put it in a comment. There is a change to the compiler, wait-until now uses goto. The labelled breaks were code generated as unlabelled breaks and although it worked out slipped through some checks. Finally, there is one warning that I cannot solve at this time so tests that produce it have been put in their own lax group.

  • Property mode set to 100644
File size: 712 bytes
Line 
1/* test attr init; set stack; get stack */
2
3#include <fstream.hfa>
4#include <thread.hfa>
5
6void* foo(void*){
7 pthread_t self = pthread_self();
8 pthread_attr_t self_attr;
9 pthread_getattr_np(self, &self_attr);
10
11 size_t size;
12 int status = pthread_attr_getstacksize(&self_attr, &size);
13 if (status != 0){
14 sout | "error return code";
15 exit(1);
16 }
17 sout | "stack size is " | size;
18 return NULL;
19}
20
21int main()
22{
23 pthread_attr_t attr;
24 pthread_attr_init(&attr);
25 pthread_attr_setstacksize(&attr, 123456789);
26 pthread_t thr;
27 void* res;
28 pthread_create(&thr, &attr, foo, (void*)0);
29 pthread_join(thr, &res);
30 pthread_attr_destroy(&attr);
31 return 0;
32}
Note: See TracBrowser for help on using the repository browser.