EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: multithread client
From: l7a <liyua@ornl.gov>
To: tech-talk@aps.anl.gov
Date: Tue, 22 Apr 2003 18:15:14 -0500
Hi,

This is part from "EPICS R3.14 Channel Access Reference Manual".

============================== 
Thread Safety and Preemptive Callback to User Code
Starting with EPICS R3.14 the CA client libraries are fully thread safe
on all OS (in past releases the library was thread safe only on
vxWorks). When the client library is initialized the programmer may
specify if preemptive call back is enabled. Preemptive call back is
disabled by default. If preemptive call back is enabled then the user's
call back functions might be called by CA's auxiliary threads when the
main initiating channel access thread is not inside of a function in the
channel access client library. Otherwise, the user's call back functions
will be called only when the main initiating channel access thread is
executing inside of the CA client library. When the CA client library
invokes a user's call back function it will always wait for the current
callback to complete prior to executing another call back function.
==============================

Can somebody show example with multithread client?

In Windows I know a creating of new thread with function. Usually,
================
Main thread
	hThread = CreateThread( NULL, 0, slFThread, 0, 0, &dwThreadID);

Function of new thread
DWORD WINAPI slFThread( LPVOID pParam){
	...
	//my part for new thread
	...
	return 0;
}

But I could not image how I can say CA library to use new (auxiliary)
thread for its callback fuctions. Is it possible I need to call
ca_add_event() or ca_pend_event() in new thread?

	I see epicsThread.h and epicsThread.cpp files. I believe this is
wrapper over os-depending threading. Am I right? Can I use this wrapper
to hide Windows and Linux threads? Can I see example too? Or have
epicsThreadTestMain.cpp and epicsThreadPrivateTest.cpp examples enough
information? 

Thanks in advance,
Andrei.





Replies:
RE: multithread client Jeff Hill

Navigate by Date:
Prev: RE: epicsTicksPerSecond for OSI ? Jeff Hill
Next: RE: multithread client Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: RE: epicsTicksPerSecond for OSI ? Jeff Hill
Next: RE: multithread client Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019