mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-04 03:32:27 +00:00
Reduce stack virtual memory consumption on Linux
This commit is contained in:
parent
cc8a9eb93c
commit
36e5861b0c
31 changed files with 583 additions and 166 deletions
17
examples/thread.c
Normal file
17
examples/thread.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// how to spawn a thread
|
||||
|
||||
void *my_thread(void *arg) {
|
||||
printf("my_thread(%p) is running\n", arg);
|
||||
return (void *)0x456L;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
void *res;
|
||||
pthread_t th;
|
||||
pthread_create(&th, 0, my_thread, (void *)0x123L);
|
||||
pthread_join(th, &res);
|
||||
printf("my_thread() returned %p\n", res);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue