This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to register timer DSR


"mohanlal jangir" <mohanlaljangir@hotmail.com> writes:

> Thanks Jonathan for your quick response. I want to know if the function
> test_alarm_func (the alarm handler in example simple-alarm.c) is called in
> interrut context?

It is called in DSR mode. So you can call any non-blocking functions.

> Basically I want to know if some other function can be called (or
> rescheduling is possible), when test_alarm_func is getting executed.

No, alarm functions execute to completion before anything else can
run, this includes other alarm functions, DSRs and threads. However,
interrupts may still be serviced while an alarm is running.

> 
> Does the following code have synchronisation problem?
> 
> test_alarm_func( ) {
>     access critical data    /* no locks here */
> }
> 
> another_function ( ) {
>     lock schedular
>     access critical data
>     unlock schedular
> }
> 
> one_more_function ( ) {
>     lock schedular
>     access critical data
>     unlock schedular
> }
> 

That would work. However it would be less disruptive to the rest of
the system to use cyg_alarm_disable() and cyg_alarm_enable() to
protect the critical region. Using the scheduler lock stops all other
threads, and DSRs running. This could have an effect on real time
responses. You should also really use a mutex for mutual exclusion
between threads.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]