LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2010, 04:32 AM   #1
geek89
LQ Newbie
 
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
Related to pthreads and timers in POSIX standard


Hi,

I have created two threads:Thread 1 and thread 2

In the main thread, i have put up a timer which generates a signal periodically when it expires, which reults in execution going to signal catcher function.

when this function is invoked, under certain condition it goes to thread 1 and under another condition it goes to thread 2.

The problem lies here that when it goes to thread2,i have a loop to process but it doesnt come out of the loop and hence from thread2, even though timer has expired . . where i am going wrong? any advice will be appreciated

Thanks
 
Old 02-17-2010, 06:17 PM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
signals and their handlers are more for inter-processes communication. I'm even not sure you can define a per-thread granularity of signal handling. IMHO you'd better go with mutexes, semaphores and conditions...
 
Old 02-18-2010, 03:57 AM   #3
geek89
LQ Newbie
 
Registered: Feb 2010
Posts: 2

Original Poster
Rep: Reputation: 0
ya, i am using mutex and cond variables also but the problem is when it goes into the for loop(runs for million time) of thread2, it runs till it is over, but i want it to come out for a moment and display the thread1 message,
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Posix timers affected by system clock changes. ljratner Linux - Software 0 11-06-2009 03:39 PM
usage of Posix timers titusabraham Programming 5 10-13-2009 06:13 PM
Posix timers not behaving correctly sean04 Programming 1 10-07-2007 11:34 PM
posix timers mailsteam Programming 7 05-18-2007 11:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration