Hi, I'm writing an executable in c that needs to have an idea of time.
I know about the time.h header, but my issue stems from needing to monitor time at the same time as other things are going on.
I have an inkling that threads are involved here.
I have spent literally the last two hours on google and have amassed a basic understanding of pthreads - how to create and use them - but I don't know how I can use one thread to tell another thread to stop doing something, without ending the entire program.
Can someone please either show me how to do this or point me to a place that can?
TIA
P.S. here is the general idea of flow that I'm going for, in pseudo-code of course:
Code:
main_thread {
create_thread
start_thread_action | start_main_thread_action
if_second_thread_says_so{
main_thread_stops_action_and_continues_with_the_rest_of_the_program
}
}