Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-09-2004, 03:10 PM   #1
Registered: Jan 2004
Posts: 105

Rep: Reputation: 15
interrupts and mutual exclusion

I need help in design for the following situation:

There is a background handler running and catching socket messages which generates a SIGIO interrupts. This interrupt invokes a handler which looks at the data on the socket and in return calls the appropriate function for it. Now the problem is some of the datastructures used are linked lists, queues, ect.. What is best way I can prevent the interrupt from messing up the list, such as when I am deleting an item and an interrupt comes in. I think a signprocmask would work with BLOCK and UNBLOCK before and after the datastructure code. I just want to verify that sigpending would work properly espeically if more signals than just SIGIO are used.

Old 12-09-2004, 03:36 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Don't mistake interrupts with signals. The two things are different. The interrupt will not deal with your data structures, but the signal handler will. You can use mutexes or semaphores to protect the list. But it's not a good solution, especially when you have onthread program (so the signal handler will be locked forever, because the lock will be never unlocked by the code). I recommend to modify your program in such a way that signal handlers only set certain variables. Then your program checks from time to time if the variable is set and if it is - runs a function that deals with what it needs.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
single IP exclusion from IPTABLES range ekrumm Linux - Security 6 12-09-2005 09:42 AM
Mutual disk space Da_Panther Linux - Laptop and Netbook 4 07-23-2005 04:30 PM
How to create mutual authentication between apache/php and tomcat nguyen_t_anh Linux - Security 0 05-14-2005 02:06 PM
BASH; exclusion list and cp TheLinuxDuck Programming 3 03-10-2005 01:59 PM
libalsa2 and libalsa-data mutual dependancies laxisusous Linux - Software 2 02-22-2005 05:05 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 AM.

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