MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / libc_ex1

Function libc_ex1

examples/libc/ex1.c:28–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27#define sucfail(r) (r != 0 ? "failed" : "succeeded")
28int libc_ex1(void)
29{
30 int pret, ret = 0;
31 pthread_t th_a, th_b;
32 void *retval;
33
34 ret += (pret = pthread_create(&th_a, NULL, process, (void *)"a"));
35 printf("create a %s %d\n", sucfail(pret), pret);
36 ret += (pret = pthread_create(&th_b, NULL, process, (void *)"b"));
37 printf("create b %s %d\n", sucfail(pret), pret);
38 ret += (pret = pthread_join(th_a, &retval));
39 printf("join a %s %d\n", sucfail(pret), pret);
40 ret += (pret = pthread_join(th_b, &retval));
41 printf("join b %s %d\n", sucfail(pret), pret);
42 return ret;
43}
44#include <finsh.h>
45FINSH_FUNCTION_EXPORT(libc_ex1, example 1 for libc);

Callers

nothing calls this directly

Calls 3

pthread_createFunction · 0.85
pthread_joinFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected