Recommended C++ wrapper for threads/semaphores/mutexes?

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats

Well, on QNX all of these things are POSIX. Take a look at CommonC++,
it provides nice versions of all of these things.

chris


John Nagle <nagle@downside.com> wrote:

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

I just looked at “Common C++”. It looks like a basically good
idea, buried under layers of GNU macro-based portability junk.
It doesn’t even do mutexes inline; it calls its own library.
There’s way too much irrelevant stuff in there, including an
XML parser(!). I was looking for something lightweight.

But if it’s available as a proper QNX repository, it
might be worth installing. Is it? I’m not going to
port that monster when I need only a few pages of code.

John Nagle
Animats

Chris McKillop wrote:

Well, on QNX all of these things are POSIX. Take a look at CommonC++,
it provides nice versions of all of these things.

chris


John Nagle <> nagle@downside.com> > wrote:

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats

Rather than struggling with that code, I rewrote
the “Mutex” and “Semaphore” classes from “Common C++”.
All C++, all inline, no macros, no autoconf. Also added
a templated bounded buffer class to replace the non-typesafe
bounded buffer class provided. All the classic Dijkstra
primitives. I’ll put them on my web site in a week or so.

License: LGPL.

John Nagle
Animats

John Nagle wrote:

I just looked at “Common C++”. It looks like a basically good
idea, buried under layers of GNU macro-based portability junk.
It doesn’t even do mutexes inline; it calls its own library.
There’s way too much irrelevant stuff in there, including an
XML parser(!). I was looking for something lightweight.

But if it’s available as a proper QNX repository, it
might be worth installing. Is it? I’m not going to
port that monster when I need only a few pages of code.

John Nagle
Animats

Chris McKillop wrote:

Well, on QNX all of these things are POSIX. Take a look at CommonC++,
it provides nice versions of all of these things.

chris


John Nagle <> nagle@downside.com> > wrote:

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats
\

Have you look at http://www.cs.wustl.edu/~schmidt/ACE-overview.html

“John Nagle” <nagle@downside.com> wrote in message
news:3E320712.5060607@downside.com

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats

It’s lightweight and LGPL, no warranty whatsoever, it should work.
It was use successfully in some university graduate level real-time
projects.

There’s a wrapper for Message Namespace, Messaging, Thread, Mutex,
Semaphore, Read-Write lock, consumer/producer with buffer or messaging
examples,
Timer with Signal or Pulse, etc.

I suggest you to test it heavilly just in case. Submit any patch! :slight_smile:

You can wrap around sem_t -OR- mutex and cond_var for Semaphore.
That version of Semaphore doesn’t use pthread_cond_var_t,
so it has a known broken priority inversion bug.
I suggest a wrap around sem_t it safer but less portable.

I forgot where I put that fixed version but you can fix it easily, with 10
lines of code.

Sincerely yours,
Fred.

fprog -at- users.sf.net

Java-to-C++ library Neutrino branch - j2k/nto/

Feel free to modify the headers path if needed, but plz give the appropriate
credits =)

Download the entire thing here:
http://unc.dl.sourceforge.net/sourceforge/j2k/j2k30oct2001.zip

Delete any files which you don’t need.

You can view the code online here:
http://j2k.sourceforge.net/src/j2k/nto/Basic_PThread.hpp
http://j2k.sourceforge.net/src/j2k/nto/Basic_PThread.cpp
http://j2k.sourceforge.net/src/j2k/nto/Basic_PThread.inl
http://j2k.sourceforge.net/src/j2k/nto/Mutex.hpp
http://j2k.sourceforge.net/src/j2k/nto/Mutex.cpp
http://j2k.sourceforge.net/src/j2k/nto/Mutex.inl
http://j2k.sourceforge.net/src/j2k/nto/RWLock.hpp
http://j2k.sourceforge.net/src/j2k/nto/RWLock.cpp
http://j2k.sourceforge.net/src/j2k/nto/RWLock.inl

http://j2k.sourceforge.net/src/j2k/nto/Semaphore.hpp
http://j2k.sourceforge.net/src/j2k/nto/Semaphore.cpp
http://j2k.sourceforge.net/src/j2k/nto/Semaphore.inl

Standard headers for portability.
http://j2k.sourceforge.net/src/j2k/Fred/Standard.hpp
http://j2k.sourceforge.net/src/j2k/Fred/Basic.hpp
http://j2k.sourceforge.net/src/j2k/Fred/Boolean.hpp
http://j2k.sourceforge.net/src/j2k/Fred/StdTypes.hpp


John Nagle wrote in message <3E32DBD0.4000506@downside.com>…

I just looked at “Common C++”. It looks like a basically good
idea, buried under layers of GNU macro-based portability junk.
It doesn’t even do mutexes inline; it calls its own library.
There’s way too much irrelevant stuff in there, including an
XML parser(!). I was looking for something lightweight.

But if it’s available as a proper QNX repository, it
might be worth installing. Is it? I’m not going to
port that monster when I need only a few pages of code.

John Nagle
Animats

Chris McKillop wrote:

Well, on QNX all of these things are POSIX. Take a look at CommonC++,
it provides nice versions of all of these things.

chris


John Nagle <> nagle@downside.com> > wrote:

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats
\

Boost threads is the best wrapper available - it is forming the basis of the
addition of threads to the C++ standard. See www.boost.org. The POSIX
implementation should compile on QNX.

Tom

“John Nagle” <nagle@downside.com> wrote in message
news:3E320712.5060607@downside.com

Is there a recommended C++ wrapper library for
QNX threads, semaphores, and mutexes? I hate to have
to re-invent the wheel here.

John Nagle
Animats