This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Re: Once again, I need a binary semaphore
- From: Grant Edwards <grant dot b dot edwards at gmail dot com>
- To: Frank Pagliughi <fpagliughi at mindspring dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 17 Mar 2015 10:19:43 -0500
- Subject: Re: Re: Once again, I need a binary semaphore
- Authentication-results: sourceware.org; auth=none
- References: <me737v$ojs$1 at ger dot gmane dot org> <5507F21B dot 1000900 at zhaw dot ch> <me9dtq$e2m$1 at ger dot gmane dot org> <me9epm$e2m$2 at ger dot gmane dot org> <550840C2 dot 8090900 at mindspring dot com>
On Tue, Mar 17, 2015 at 10:57:06AM -0400, Frank Pagliughi wrote:
> I'm in agreement, for what it's worth. I've had to make use of the
> binary semaphore through the C++ API, and it always made me wonder why
> it wasn't brought out to the public/C API.
I've been asking that for 15 years. OK, I exaggerate. I just looked
itup and the first thread I started on this top was March 2001, so
it's only been 14 years. The reason given for lack of a binary
semaphore C API was:
It was never intended that the KAPI be a complete reflection of the
kernel implementation. It is meant to be a consistent,
self-contained, small API that can be used by C applications. Like
the uITRON and POSIX APIs it only exposes a subset. It was
considered unnecessary to export binary semaphores, since a
counting semaphore initialized to 1 is functionally equivalent.
If I had had my way the KAPI would have been even more minimal that
it currently is.
--
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK
Except a counting semaphore initialized to 1 is _not_ functionally
equivalent to a binary semaphore in all cases. I pointed this out and
provided examples of sequences of wait/post where the behavior
differs, but was told those sequences were "bugs" and (jokingly, I
hope) if I didn't shut up and stop asking questions then the C++
binary semaphores would be removed copletely.
It was quite clear that Nick was adamantly opposed to providing a C
API for binary semaphores and that the needs of eCos users'
application code were to be overruled by his idea of what an comprised
a minimal, complete, elegent set of C APIs: people who want to
write/port C apps that use binary semaphores should just and rewrite
the application code.
IOW, all you really need are two-input NAND gates to model any Turing
complete machine so stop bitching and get to work.
--
Grant
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss