Hi Matt & Mark,
On Wednesday 20 April 2011 15:06:33 Matt Newville wrote:
> On Wed, Apr 20, 2011 at 1:04 PM, Vigder, Mark
> <[email protected]> wrote:
> > The only difference is I created some arbitrary unrelated PV before
> > starting the thread. I'm still
> > trying to understand CA contexts, so I'm not sure those calls are
> > necessary, but
> > for some things I tried they seemed to be required. Other little changes,
> > such as creating the
> > PV object inside the thread rather than passing it in to the thread, also
> > seem to eliminate the 30 second delay.
> > Trying on my PC rather than linux co-hosted with IOC gives about a 10
> > second delay.
> >
> > Any help or explanations are well appreciated.
>
> The default timeout for pv.put() in "put-with-wait" mode is 30
> seconds, which is probably where that time is coming from.
>
> It appears that the put-with-wait is not announcing completeness
> across "contexts" (that is you create a PV in the main thread, then
> create a new context in the created thread and do the put-with-wait on
> the PV from the original thread). It's possible thatt the
> put-with-wait is not complete enough for dealing with all thread cases
> right now.
Assuming that epics.ca.context_create() results in a call to
ca_context_create() then I worry that Mark's code ends up trying to use a chid
created in one CA context (associated with the object m) in a thread that is
running with a different CA context. Internally a chid has a reference to the
context it was created in, and I have no idea what happens if you use one this
way, but I'm fairly sure you're not supposed to.
I would recommend that you share a single CA context across all the threads in
your program unless you have a very good reason to not do that, it saves
resources. To do that you'll need to find out what the PyEpics equivalents
are of the routines ca_current_context() and ca_attach_context(), and pass the
context pointer returned by calling ca_current_context() from the main thread
into the new thread and there passing it to ca_attach_context().
HTH,
- Andrew
--
An error is only a mistake if you don't learn from it.
When you learn something from it, it becomes a lesson.
- Replies:
- RE: PyEpics and Python threads Vigder, Mark
- References:
- PyEpics and Python threads Vigder, Mark
- Re: PyEpics and Python threads Matt Newville
- Navigate by Date:
- Prev:
Re: status of Debian/Ubuntu packages/repositories Bill Lavender
- Next:
RE: PyEpics and Python threads Vigder, Mark
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: PyEpics and Python threads Matt Newville
- Next:
RE: PyEpics and Python threads Vigder, Mark
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|