pcp
[Top] [All Lists]

Re: Opening multiple contexts

To: Ken McDonell <kenmcd@xxxxxxxxxxxxxxxxx>
Subject: Re: Opening multiple contexts
From: Olivier Tarnus <o.tarnus@xxxxxxx>
Date: Mon, 25 Oct 2004 10:38:30 +0200
Cc: pcp@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.61.0410251050001.5227@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <41790B32.9040707@xxxxxxx> <Pine.LNX.4.61.0410251050001.5227@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: pcp-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 0.8 (X11/20040917)
Thanks Ken and Mark,

kenmcd@xxxxxxxxxxxxxxxxx wrote:

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.

I'll stick to this one...

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^)>

Not on my todo for the moment ;-) Need first to really work on my C...

However, i'm going to refine my c++ class for pcp access, an it would perhaps be nice to include it in pcp, if its quality meet your criteria (far from now ;-)

Olivier



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