This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: Last version of message queues.
Aurelio,
Ross Johnson wrote:
>
> Hi Aurelio,
>
> Last time I looked you needed PTHREAD_PROCESS_SHARED mutexes
> and condition variables. The code you just sent does the same
> as last time.
>
> _POSIX_THREAD_PROCESS_SHARED isn't defined in pthreads-win32, nor
> in Linux I believe (although I could be out of date there).
>
> For example, in mq_open() you have the following code:
>
> if ( (i = pthread_mutexattr_init(&mattr)) != 0)
> goto pthreaderr;
> pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
> i = pthread_mutex_init(&mqhdr->mqh_lock, &mattr);
> pthread_mutexattr_destroy(&mattr); /* be sure to destroy */
> if (i != 0)
> goto pthreaderr;
>
> if ( (i = pthread_condattr_init(&cattr)) != 0)
> goto pthreaderr;
> pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED);
> i = pthread_cond_init(&mqhdr->mqh_wait, &cattr);
>
> The *attr_setpshared() calls will be returning ENOSYS errors.
>
I apologise - it's pthread_{mutex,cond}_init() that should be
returning ENOSYS, not *attr_setpshared(). Since you're catching
that I'm now confused so I'll go take a longer harder look.
Sorry.
Ross