Created
June 25, 2023 08:10
-
-
Save kusa-mochi/21f4a439851c69fd176254d3b926cd36 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdio.h" | |
#include "pthread.h" | |
void *TestRoutine(void *p) { | |
int testVar = 123; | |
printf("TestRoutine - testVar:%d\n", testVar); | |
int *ip = (int *)p; | |
ip = &testVar; | |
} | |
int main(void) { | |
pthread_t pthread; | |
int *testPointer = NULL; | |
pthread_create(&pthread, NULL, &TestRoutine, testPointer); | |
pthread_join(pthread, NULL); | |
printf("main - testVar:%d\n", *testPointer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment