Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-21-2007, 03:37 AM   PM User | #1
tricolaire
Regular Coder

 
Join Date: Apr 2005
Location: PA
Posts: 117
Thanks: 0
Thanked 0 Times in 0 Posts
tricolaire is an unknown quantity at this point
pthreads - messages

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   
   }

}
tricolaire is offline   Reply With Quote
Old 09-22-2007, 03:06 AM   PM User | #2
tricolaire
Regular Coder

 
Join Date: Apr 2005
Location: PA
Posts: 117
Thanks: 0
Thanked 0 Times in 0 Posts
tricolaire is an unknown quantity at this point
ending a thread

ok, the question has changed

I need to know how to kill a pthread before it has finished its process.

I know about the function pthread_cancel, but that function isn't implemented in Mac OS X, or so I'm told, and the discussions I've found on this topic all pertain to how to do such a thing in very specific projects that have little to do with my own.

any help is greatly appreciated

Thank you
tricolaire is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:16 PM.


Advertisement
Log in to turn off these ads.