[VxW] Semtake in ISR:- reg
Jeff Johnson
jjohnson at airflownetworks.com
Sat Mar 27 09:58:49 PST 2004
The fact that semTake() may block is not the only reason you can't call it from an ISR context. You must be running as a task when you call semTake() because the WIND_TCB is updated as a result of the semTake() and there is no TCB in an ISR context.
There is also the issue of what do you do if the application is holding the semaphore when the ISR executes. In other words, if you were to call semTake(sem,NO_WAIT) and ERROR was returned, what would you do?
If you are sharing data between an ISR and an application, you need to look at alternatives that don't use semaphores. One suggestion is to use intLock() in the application to hold off any potential impact from the interrupt. An alternate approach is to have the ISR send a message to a high priority task using msgQSend() and let the high priority task perform the data manipulation.
-----Original Message-----
From: ganesh.murugesan at wipro.com [mailto:ganesh.murugesan at wipro.com]
Sent: Fri 3/26/2004 9:19 PM
To: vxwexplo at csg.lbl.gov
Cc:
Subject: [VxW] Semtake in ISR:- reg
Hi,
I am working on a FC switching product that uses SA110/vxWorks5.4. I am
planning to manipulate a shared data structure in the ISR context for
performance enhancement. Before manipulating the shared data structure,
I would like to protect it using semaphore. I know that it is illegal to
acquire semphores in ISR context since it is a blocking call. I would
like to know if I can use semTake with "NO_WAIT" option in ISR context.
I believe that semTake with "NO_WAIT" should be a non blocking call. Can
someone advise me on this.
Thanks
Ganesh
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.
_______________________________________________
VxWorks Users Group mailing list
VxWexplo at lbl.gov
http://www-csg.lbl.gov/vxworks/
More information about the VxWexplo
mailing list