We have a RTOS library code in C which has a for loop something like below:
int exec{}
{
for(;;)
{
...................
getbuffer(&req) || processbuffer(&req)
{
error = -1;
return error;
}
}
}
int getbuffer(buf *req)
{
......
fn1();
.......
}
int fn1()
{
.................
}
In fn1 I am implementing a new code that calls a callback but cannot wait for it's execution- the callback will be called by another thread.
This is the issue - function getbuffer resumes flow resumes even before callback is called. The expected scenario is that callback should be called first followed by further execution of getbuffer flow?
How can I achieve the same?
Aucun commentaire:
Enregistrer un commentaire