From: Matej S. <mat...@co...> - 2011-04-05 18:06:04
|
What about simply checking thread ID each time createChannel is called. Then you can have a map<thread ID, ca_context> to get existing ca_context ore create a new one (and put it on map). Of course, you cache it in your own channelV3 impl. You release contexts in destory() methods. Sure, you need ref. count (shared_ptr). Matej On Tue, Apr 5, 2011 at 7:51 PM, Marty Kraimer <mrk...@co...> wrote: > On 04/05/2011 01:12 PM, Marty Kraimer wrote: > > > 2) Is there some way for me to get called by this thread shortly after >> the thread is created? >> > > 3) I want to call ca_context_destroy when the thread is being destroyed. >> How? > > > Hmmm.... does epicsThread (or pvData Thread object) allows API to monitor > thread creation/destruction? > > > Not that I can see. > > I see a solution without requiring changes elsewhere. > > I already have a class CAV3Context. > I will make it a singleton. > It has a method start. I will and a method stop. > When a channel is created it will cal start and when destroyed stop. > It will keep a reference count. > When reference count reaches 0 it will call ca_context_destroy. > > Don't know what I was thinking. This will not work. > I will get called for many different pvAccess clients. Each has different > thread. > > Needs more thought. > > Marty > > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Epics-pvdata-core mailing list > Epi...@li... > https://lists.sourceforge.net/lists/listinfo/epics-pvdata-core > > |