I am trying to create this function in order to exec another function after X time:
void execAfter(double time, void *(*func)(void *), t_params *params);
I have made an Thread encapsulation and a Time encapsulation (objects Thread and Time).
What I want to do in pseudo code:
Call execAfter
instantiate Thread
call thread->create(*funcToExec, *params, timeToWait)
[inside thread, leaving execAfter]
instanciate Time object
wait for X time
exec funcToExec
delete Time object
[leaving thread, back to execAfter]
delete Thread object <---- probleme is here, see description below.
return ;
How can I delete my Thread object properly, without blocking the rest of the execution nor taking the risk to delete it before required time has elapsed.
I am quite lost, any help appreciated!