Imagine this:
int foo(void* arg) {
int v = *(int*)arg; // is arg a potential dangling pointer here?
}
thrd_t t;
int bar() {
int my_variable = 42;
int ret = thrd_create(&t,foo,&my_variable);
return ret;
}
what is the order of execution here? Since foo
runs on a different thread and we do not actually wait for the thread to finish/join – but thrd_create returns – is arg
a potential dangling pointer?