Hello,
I have a for loop, and after this loop, I am calling another function that wakes a thread S, and then thread S carries on its execution.
Code:
for (k = 0; k < num_msg; k++) {
if( (c % Messages[k][2] ) == 0 ) {
printf("\n%d, act, %d\n", Messages[k][0], c );
db_Lock();
update_status( Messages[k][0], 1);
db_UnLock();
}
}
ret = invoke_thread_S();
I am getting an anomalous output. Before all the iterations of for loopcould finish, the program enters into the invoke_thread_S() and I can see the remaining iterations of for loop happening while the thread S is continuing.
What could be the problem here. Can I put a 'sleep' before I enter into invoke_thread_S() function, I tried it with a very small amount (in nano seconds), but that did not solve the problem.
thanks,