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: binary vs. counting semaphore and timed wait


David Brennan <eCos@brennanhome.cxm> writes:

> In the process of porting an application to eCos, I came across the use
> of a binary semaphore with a timed wait function.  The eCos
> Cyg_Binary_Semaphore interface does not provide this.  But it sure looks
> like the rest of the code is similar enough to the counting semaphore
> that it could be implemented very easily.  However before I do this, is
> there some particular reason this was not implemented?  I'd be very
> interested to hear if this is a bad idea.
> 

Timeouts were added to the counting semaphores because it was needed
for POSIX compatibility. Nobody needed it in the binary semaphores
until now.

If you want to add a timed wait for binary semaphores, go ahead. Make
sure you ifdef it with CYGFUN_KERNEL_THREADS_TIMER, and follow the
example of the counting semaphores. In theory it should be a fairly
simple copy-paste-edit of the counting semaphores code.

When you have it done, submit a patch on the patches list, with a
ChangeLog entry, and someone will check it over and commit it to the
repository.


-- 
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]