The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Threads and Threads Count ? varungupta UNIX for Advanced & Expert Users 2 03-21-2008 06:23 PM
Multi-threading-- calling same function through different threads arunchaudhary19 High Level Programming 1 12-10-2007 08:54 AM
Multi User Multi Task Reza Nazarian UNIX for Dummies Questions & Answers 6 04-13-2006 06:23 AM
Multi-threading questions DreamWarrior High Level Programming 1 11-02-2003 08:34 PM
multi-file multi-edit kielitaide UNIX for Dummies Questions & Answers 12 06-28-2001 12:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-04-2006
Registered User
 

Join Date: Jul 2006
Posts: 1
Question Questions about timer in multi-threads environment

Hi

I have questions about timer function in multi-threads environment.

My application has multi-threads, in one thread, I set a timer, when the timer expires, the timer function will interrupt other thread and execute.

I am not clear which thread will be interrupted by the timer function ?
Does the thread in which I set the timer be interrupted, or it depends on OS.

If my application is running on one CPU machine, I think the current thread will be interrupted. If the application is running on mult-CPU machine, and SMP is on, which thread will be interrupted.

If the thread I set the timer has finished and gone, when timer expires, what will happen ?


thanks & regards
Jeffrey
06-07-04
Reply With Quote
Forum Sponsor
  #2  
Old 12-11-2007
Registered User
 

Join Date: Mar 2006
Location: Ahmedabad
Posts: 119
Open source is life savor

See the page
WebSVN - packet-o-matic - Rev 157 - -trunk-src-timers.c

https://svn.tuxicoman.be/filedetails...Ftimers.c&sc=1

Both timer.c and timer.h is complete implementation
Reply With Quote
  #3  
Old 12-11-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by longskys View Post
My application has multi-threads, in one thread, I set a timer, when the timer expires, the timer function will interrupt other thread and execute.

(a) what mechanism are you using for timers?

(b) what do you mean by interrupt?

I do hope you are using "pthread_cond_timedwait". From what you say I would suggest you don't need a separate timer thread, you have "other thread" wait on "pthread_cond_timedwait".
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0