EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PyEpics and Python threads
From: Matt Newville <[email protected]>
To: "Vigder, Mark" <[email protected]>
Cc: EPICS Tech Talk <[email protected]>
Date: Thu, 21 Apr 2011 13:22:13 -0500
Hi Mark,

On Thu, Apr 21, 2011 at 9:12 AM, Vigder, Mark
<[email protected]> wrote:
> I did exactly as you suggested below. I assumed that the exception
> being returned was a mistake. I'll pull the latest version with
> the fix.

Thanks.

> Another option for making the code more "plain looking" is to
> use a single CA context and subclass Python's threading.Thread.
> This subclass can be used for creating threads in PyEpics and
> the subclass could switch to the single context in use. This
> of course only works if there is a single context for the
> application.

Subclassing threads seems like more work to me too.  The change to PV
to save its context and then make sure that is used for put() and
get() is just a couple lines of code -- I can check that the context
is correct in the same routine used to make sure the channel is
connected.  And that does allow PVs created in the main thread to be
used in child thread.  Creating PVs in a non-main thread still
requires creating a new context.

I pushed a branch (pv_savecontext) with this change to github.  It
seems to work, but I have not fully documented this or tested it on
all systems.   The simple tests work for me on linux and windows.

Cheers,

--Matt

Replies:
Re: PyEpics and Python threads Andrew Johnson
References:
PyEpics and Python threads Vigder, Mark
Re: PyEpics and Python threads Matt Newville
Re: PyEpics and Python threads Andrew Johnson
RE: PyEpics and Python threads Vigder, Mark
Re: PyEpics and Python threads Matt Newville
RE: PyEpics and Python threads Vigder, Mark

Navigate by Date:
Prev: Handling of String Array in CaChannel library Ritesh Sugandhi
Next: Re: seq-2-0-13-rc2 J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: PyEpics and Python threads Vigder, Mark
Next: Re: PyEpics and Python threads Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·