activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: CMS supports bytes messages
Date Tue, 25 Apr 2006 16:46:21 GMT
On 4/25/06, Mittler, Nathan <nathan.mittler@sensis.com> wrote:
> Hey Hiram,
> It's surprising that OS X doesn't support recursive locks - I thought
> they were a standard part of pthreads.  Even more surprising is when you
> try to lock twice from the same thread, it deadlocks itself :)

Sorry I was not more clear..  the code that enabled recursive mutex
was #if defined out.   I made a small tweak to enable that part of the
code on OS X.

>
> I am in total agreement about sprinkling #ifdefs around the code - it's
> ugly and we'll have to keep tweaking them to support new platforms.  But
> I don't think there is a way that we can get rid of them - it's just one
> of the many nasty parts of coding in C++.  Even with autoconf you still
> have to have them there - autoconf just picks which ones to enable based
> on your environment.  I'm definitely open to suggestions.
>

Yeah.  Can't get around it.  The upside to autoconf is that #defines
are coded in terms of features that the platform supports.  Not in
terms of what the platform is.

#if defined( PTHREADS )
instead of
#if defined (unix) || defined(__APPLE__)

And the PTHREADS define is enabled when autoconf runs a script to
verify that the current platform does indead support PTHREADS.  So,
it's much saner and robust since it avoids asumptions that all unixs
or apple platforms support pthreads.

The real downside is that maintaining those autoconf scripts is going
to be a hassle and not a lot of folks are trained in that art.

> Regards,
> Nate
>
> -----Original Message-----
> From: chirino@gmail.com [mailto:chirino@gmail.com] On Behalf Of Hiram
> Chirino
> Sent: Tuesday, April 25, 2006 11:48 AM
> To: activemq-dev@geronimo.apache.org
> Subject: Re: CMS supports bytes messages
>
> Hi Nathan,
>
> I assume you've committed that patch to SVN by now.
> I was just testing the latest cms against the latest activemq on OS X
> and ran into an issue where the client was hanging in the
> StompTransport::addMessageListener call.
>
> Root cause: the mutex being used did not seem to support recursive
> locking.
>
> The following patch fixes the issue for me.  I'll commit it as soon as
> SVN starts working again.
> I'm not feeling very good about sprinkling all these if defs around
> the code.  I'm sure we are going to have to update these constantly as
> we support more platforms.  Would using autoconfig help us with these
> issues?
>
> Index: activemqcms/src/activemq/concurrent/Mutex.h
> ===================================================================
> --- activemqcms/src/activemq/concurrent/Mutex.h (revision 396884)
> +++ activemqcms/src/activemq/concurrent/Mutex.h (working copy)
> @@ -47,9 +47,9 @@
>             pthread_mutexattr_t attributes;
>             pthread_mutexattr_init( &attributes );
>
> -            #ifdef __USE_UNIX98
> +       #if defined(__USE_UNIX98) || defined(__APPLE__)
>                 pthread_mutexattr_settype( &attributes,
> PTHREAD_MUTEX_RECURSIVE );
> -            #endif
> +       #endif
>
>             // Initialize the mutex.
>             pthread_mutex_init( &mutex, &attributes );
>
>
> On 4/23/06, Nathan Mittler <nathan.mittler@gmail.com> wrote:
> > I know a few of people were waiting for feedback on this - so I'm
> sending to
> > both lists.  I've just submitted a couple of patches to the stomp C++
> client
> > (CMS).  One fixes the way it was handling the broker url, and the
> other
> > fixes the handling of the bytes message.  It all looks good now - I
> tested
> > against the April 19th incubator snapshot of AMQ.  You'll need a
> recent
> > version of the broker as there have been a few patches made on the
> stomp
> > interface.
> >
> > Regards,
> > Nate
> >
> >
>
>
> --
> Regards,
> Hiram
>


--
Regards,
Hiram

Mime
View raw message