This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Lightweight C++ multithreaded exceptions
Øyvind Harboe wrote:
On Mon, 2005-05-23 at 11:52 +0200, Jerome Souquieres wrote:
That's interesting. However, from what I understand, this approach
only solves the multithreaded exceptions problem. This does nothing to
ensure that the standard C++ library (including STL) is thead safe. Am
I right ?
I know there are some atomicity issues, but is that already handled in a
CPU architecture specific but os-independent fashion by default in
libstdc++?
libstdc++ has atomicity primitives for some CPUs, including x86, m68k,
mips, powerpc and SPARC. Notably it doesn't include ARM, probably because
at least on some ARM architecture versions it isn't possible. I don't know
for definite about recent ARM architecture versions.
But even that little atomicity support is only used in a handful of
places, and on unsupported architectures it falls back to mutexes if
available. However the key issue is that STL primarily uses OS mutexes if
available, and also needs "once" variables. Without those, it is not
thread-safe.
Does anyone know of a definitive list of issues w.r.t. libstdc++ &
multithreading?
There is support for multithreading, but you have to do it its way.
It's possible to hack it of course, but to do it the right way takes more
effort. Certainly I had to make other changes to eCos (and the tools) to
properly pass the libstdc++ testsuite. As you may have seen, there's a lot
of tests there!
It's probably inappropriate for me to comment on your suggested changes to
kernel rescheduling to support the fc_static munging, but personally I
don't believe kernel modifications are the right way. I know, I know,
sitting here with it all working, I would say that wouldn't I :-).
I guess the fact that eCosCentric is destined to contribute their
libstdc++ support saps my initiative for contributing patches in this
area.
While that is ultimately true, as I indicated before, it will not be in
the near future. Anyone who hopes to hang on a bit in their project for it
to be released publically is likely to be disappointed.
> Even more so, because I have a solution for my needs.
Your patches and instructions will certainly work in some situations. Some
of it was using the code I included for our own C++ support anyway but did
release :-), e.g. CYGPKG_LIBC_I18N_NEWLIB_CTYPE. But there are definitely
a lot of gotchas once you introduce variation, including when you change
to different architectures or try to use the libstdc++ library itself.
Jifl
--
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss