pcp
[Top] [All Lists]

Re: Opening multiple contexts

To: Olivier Tarnus <o.tarnus@xxxxxxx>
Subject: Re: Opening multiple contexts
From: kenmcd@xxxxxxxxxxxxxxxxx
Date: Mon, 25 Oct 2004 10:55:21 +1000 (EST)
Cc: pcp@xxxxxxxxxxx
In-reply-to: <41790B32.9040707@free.fr>
References: <41790B32.9040707@free.fr>
Reply-to: Ken McDonell <kenmcd@xxxxxxxxxxxxxxxxx>
Sender: pcp-bounce@xxxxxxxxxxx
On Fri, 22 Oct 2004, Olivier Tarnus wrote:

Hi all,

I was wondering if it's possible to open multiple contexts and specifying them in pmFetch or pmLookupDesc... I want to get multiple data from multiple hosts in the same program, and as pmapi is not thread safe, the only alternative would be to go multi-process and opening contexts in each process.
However this would greaty complicate access to gathered data, so is fork() my only alternative???

Creating multiple contexts is not a problem.

Having multiple threads calling libpcp at the same time is going
to get you into strife.

All the PCP applications we've developed do round-robin fetches from
multiple hosts using a single thread for all libpcp calls ... in practice
this has worked out just fine.

If you have a counter example where this does not work, I'd be interested
in hearing about it.

The alternative of making libpcp thread-safe is a homework project for
someone who's very keen ... it is not on my resourced roadmap ... 8^)>


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