MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / TestStack

Function TestStack

test/pthread/test_pthread_attr_getstack.c:15–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <unistd.h>
14
15void TestStack() {
16 pthread_attr_t attr;
17 int rc;
18 void *stbase;
19 size_t stsize;
20 char dummy;
21
22 rc = pthread_attr_init(&attr);
23 assert(rc == 0);
24
25 rc = pthread_getattr_np(pthread_self(), &attr);
26 assert(rc == 0);
27
28 rc = pthread_attr_getstack(&attr, &stbase, &stsize);
29 assert(rc == 0);
30
31 printf("size=%zu base=%p base+size=%p dummy=%p\n", stsize, stbase, (char*)stbase + stsize, &dummy);
32
33 assert(&dummy >= (char*)stbase);
34 assert(&dummy <= (char*)stbase + stsize);
35}
36
37void *ThreadMain(void *arg) {
38 TestStack();

Callers 2

ThreadMainFunction · 0.85
mainFunction · 0.85

Calls 5

pthread_attr_initFunction · 0.85
pthread_getattr_npFunction · 0.85
pthread_attr_getstackFunction · 0.85
printfFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected