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: kernel API


Nick Garnett <nickg at eCosCentric dot com> writes:

> Sergei Organov <osv at javad dot ru> writes:
[...]
> > Besides, the C++ stuff has a rather boring deficiency. I do use C++ stuff
> > directly (through my own C++ wrappers), but I still can't find any
> > reasonable answer to the question why condvars and mutexes have been put
> > into the same header 'mutex.hxx'. I don't think anybody would expect to
> > find a 'ConditionVariable' class in a 'mutex' header ;)
> > 
> 
> The implementations are in the same file, so they also share a header.

IMHO that's also a mistake though I don't care much where implementations are.
I don't like the situation when all source files that use mutexes but don't
use condvars are polluted with the condvars declarations.

> This is because they constitute a single synchronization mechanism,
> and therefore belong together.

I'd agree if one couldn't be used without another. However, while condvars
indeed can't be used without mutexes, mutexes are pretty useful without
condvars, so IMHO the most straightforward and correct approach is to have
separate 'mutex.cxx/mutex.hxx' and 'condvar.cxx/condvar.hxx', where either
'condvar.cxx' or 'condvar.hxx' includes 'mutex.hxx'.

-- 
Sergei.


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