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
|