Socket calls from timer functions (server based)

Steve Holle sholle at link-comm.com
Wed Apr 13 14:16:49 UTC 2005


We trigger a signal from our interrupt which fires another thread that is 
blocking on the signal, and perform the processing there, including socket 
calls.

If you are interested I'd be glad to forward the pertinent source.

At 08:15 PM 4/12/2005, Ian Caddy wrote:
>Hi Gene,
>
>As far as I am aware, the TSRs run in the context of the timer interrupt 
>service routine, which means you can only perform operations that are safe 
>in interrupts.
>
>Network functions are generally not safe to call from interrupts, as most 
>network functions are blocking functions.
>
>You will probably need to find another way to implement this, such as 
>sending an event or message to a thread that can perform the setsockopt.
>
>I hope this helps.
>
>regards,
>
>Ian Caddy
>Goanna Technologies Pty Ltd
>
>
>Smith, Gene SEA wrote:
>>If I try to make a socket call, e.g., setsockopt, from inside the server
>>based timer action function it fails in _CORE_mutex_Seize apparently
>>because dispatching is disabled in _Timer_Server_body (file
>>timeserver.c). Is there anyway around this limitation or should I "don't
>>do that"?
>>My timer service routine (TSR), which does socket calls, is called right
>>after _Thread_Disable_dispatch() in _Timer_Server_body(). I was hoping
>>my TSR could do anything a normal task could do, i.e., networking calls.
>>Gene
>
>Steve Holle
>Link Communications, Inc.
>1035 Cerise Rd.
>Billings, MT  59101
>sholle at link-comm.com  




More information about the users mailing list