pcp
[Top] [All Lists]

Re: Opening multiple contexts

To: Olivier Tarnus <o.tarnus@xxxxxxx>
Subject: Re: Opening multiple contexts
From: Mark Goodwin <markgw@xxxxxxx>
Date: Sat, 23 Oct 2004 08:02:09 +1000 (EST)
Cc: pcp@xxxxxxxxxxx
In-reply-to: <41790B32.9040707@xxxxxxx>
References: <41790B32.9040707@xxxxxxx>
Sender: pcp-bounce@xxxxxxxxxxx


On Fri, 22 Oct 2004, Olivier Tarnus wrote:


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.

Olivier,

you can create as many contexts are needed, to the same or
different hosts. The pmNewContext(3) call returns a unique
handle that can be passed to any of the following functions
to manage contexts :

pmDestroyContext(3), pmDupContext(3), pmReconnectContext(3),
pmUseContext(3), pmWhichContext(3)

In your case, just create a new context to each host and then
call pmUseContext(3) to set the current context before each
pmFetch.

Thanks
-- Mark

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