pcp
[Top] [All Lists]

Steps towards a thread-safe libpcp

To: pcp@xxxxxxxxxxx
Subject: Steps towards a thread-safe libpcp
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Tue, 22 Mar 2011 09:55:29 +1100
Reply-to: kenj@xxxxxxxxxxxxxxxx
Making libpcp threadsafe is a (stretch) goal for PCP 4.0.

I've started this work, but need some feedback and consensus from the
broader PCP community before going too far.

Specifically,

     1. Are pthreads the right abstraction to be using as the basis ...
        and first, does the attached code fragment compile without
        warnings, link with -lpthread, run and produce the output
        "Congratulations, you're in a bozo-free zone"?
     2. Do we want to drag libpthread into every PCP app? ... this seems
        unavoidable, as we need some mutex services, even if the library
        itself is not multi-threaded.

The code works as expected on ia32 Ubuntu and Mac OS X 10.6 ... I'd be
keen to get confirmation from others with access to a more varied set of
platforms ... e.g. RedHat and SuSE variants, Solaris, Windows,
x86_64, ...

Attachment: pthreadmutex.c
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>