On Monday 28 March 2011 09:57:27 Dirk Zimoch wrote:
>
> If I create a CA client context with
> ca_context_create (ca_disable_preemptive_callback);
> or, what is the same, with
> ca_task_initialize();
> in which thread context will then the callback handlers be called? Is it
> in the context of the thread that calls ca_pend_io() or still in the
> context of a separate thread? How was it implemented in 3.13?
In 3.14 the CA client callbacks are *always* made in the context of an
internal CA thread, and never of the thread that called ca_pend_io() /
ca_pend_event(). If you use the above calls to initialize the library the
callbacks are only ever called while the other thread is still executing the
ca_pend_*() library routine, so you do not have to include mutexes in your
code.
It occurs to me that there *could* be some circumstances where that's not
strictly true, if the ca_pend_* thread responds to a signal, but that would be
fairly unusual and would probably break the rules for signal handlers anyway.
In 3.13 the callbacks were made from the thread that called ca_pend_*(), CA
was not multi-threaded internally and did all its I/O using the select() OS
call. The CAS still uses this approach.
- 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: CA and threads Dirk Zimoch
- References:
- CA and threads Dirk Zimoch
- Navigate by Date:
- Prev:
64-bit Channel Archiver Robert Petkus
- Next:
Re: how to build c++ Andrew Johnson
- 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:
CA and threads Dirk Zimoch
- Next:
Re: CA and threads Dirk Zimoch
- 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
|