Re: Re: Thread suspend when scheduler is locked.
Jonathan Larmour <jifl <at> eCosCentric.com>
2012-07-01 02:45:17 GMT
On 21/06/12 15:57, Sergei Organov wrote:
> Nick Garnett <nickg <at> calivar.com> writes:
>> On 21/06/12 12:51, Sergei Organov wrote:
>>> Nick Garnett <nickg <at> calivar.com> writes:
>>>> Essentially locking the scheduler yourself is like running in a DSR,
>>>> there is only a limited number of calls it makes sense to use, and their
>>>> effects may be deferred until the scheduler lock returns to zero.
>>> So, there is no way in eCos to just disable _preemption_? I.e.,
>>> (temporarily) switch from preemptive to cooperative multi-threading?
>> Not really. You could try implementing a new scheduler that only did
>> context switches when a yield function is called. If you disable
>> timeslicing and run all your threads at the same priority they will
>> essentially run round-robin and only lose the CPU when they explicitly
>> suspend, although higher priority threads will still preempt.
> No, I need full-featured preemptive scheduling with multiple real-time
> thread priorities. I thought "disable preemption" feature is pretty
> standard among RTOSes and have it in my RTOS abstraction layer,
> implemented as a call to cyg_scheduler_lock() in eCos as disabling
> preemption is what description of the call claims.
The problem with any sort of abstraction layer is matching what you mean with
what exactly is provided. In particular does disabling pre-emption mean that
DSRs should be disabled too? From what you're saying, I think you mean that
DSRs should still be allowed.