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

bridged with qdn.public.qnxrtp.devtools
Post Reply
John Nagle

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

Post by John Nagle » Sat Jan 25, 2003 3:40 am

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

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

Post by Chris McKillop » Sat Jan 25, 2003 6:39 am

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/

John Nagle

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

Post by John Nagle » Sat Jan 25, 2003 6:47 pm

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


John Nagle

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

Post by John Nagle » Sun Jan 26, 2003 7:18 am

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



Rejean Senecal

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

Post by Rejean Senecal » Fri Jan 31, 2003 7:16 pm

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

Fred

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

Post by Fred » Mon Feb 10, 2003 3:44 am

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! :)

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/sourcefor ... ct2001.zip

Delete any files which you don't need.

You can view the code online here:
http://j2k.sourceforge.net/src/j2k/nto/ ... Thread.hpp
http://j2k.sourceforge.net/src/j2k/nto/ ... Thread.cpp
http://j2k.sourceforge.net/src/j2k/nto/ ... Thread.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



Tom Widmer

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

Post by Tom Widmer » Mon Feb 17, 2003 1:36 pm

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

Post Reply

Return to “qdn.public.qnxrtp.devtools”