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  2011  2012  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  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024
<== Date ==> <== Thread ==>

Subject: Asyn connection/communication management with asynPortDriver
From: Yann Mandza via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Tue, 20 Feb 2024 15:08:45 +0000
Hi, I would like to use the connection/communication management features of Asyn with a TCP/IP based driver using the asynPortDriver class. I have a limitation to the underline device driver that expose the device has a non-thread-safe object
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
Hi,
 
I would like to use the connection/communication management features of Asyn with a TCP/IP based driver using the asynPortDriver class.
I have a limitation to the underline device driver that expose the device has a non-thread-safe object , meaning it should only be access from the thread that made the API call to initiate the device handle.
 
what I want to do, is to create the device handle instance within the asyn port thread, instead of the main thread. thus, all record init and runtime operation should be performed from inside the asyn porthread.  is that possible?
my understand of asyn port drivers is still cloudy somehow. this works, but the handle is hosted by the main thread.
 
drvXXTest::drvXXTest( const char *portName, const char *interface, const char *icsCtrtype, epicsInt16 autoConnect )
        : asynPortDriver( portName,
                1, // maxAddr
                NUM_PARAMS,
                // Interface mask
                asynCommonMask | asynInt32Mask | asynUInt32DigitalMask | asynFloat64Mask | asynDrvUserMask | asynOctetMask,
                asynCommonMask | asynInt32Mask | asynUInt32DigitalMask | asynFloat64Mask | asynOctetMask,
                ASYN_CANBLOCK, // asynFlags.
                autoConnect, // Autoconnect
                0, // Default priority
                0 ), // Default stack size
{
        static const char *functionName = "drvXXTest";
 
 
        pasynManager->exceptionDisconnect( pasynUserSelf );
                // How to to call devConnect(deviceSession_, interface_) from port thread?
                // as this call run from the main one.
                asynStatus status = this->connect( pasynUserSelf );
 
                if( status ) {
                  asynPrint( pasynUserSelf, ASYN_TRACE_ERROR,
                                        "drvXXTest, error calling connect - %s\n",
                                        pasynUserSelf->errorMessage );
                }
 
        }
}
 
asynStatus drvXXTest::connect(asynUser *pasynUser) {
// devConnect instantiate the device handle and open a connection to it.
        if( !devConnect(deviceSession_, interface_) ) {
    epicsSnprintf( pasynUser->errorMessage,pasynUser->errorMessageSize,
                   "%s: Can't open %s: %s", deviceSession_, interface_, strerror( errno ) );
    return asynError;
        }
        pasynManager->exceptionConnect( pasynUser );
 
        return asynSuccess;
 
}
 
Cheers,
 
Yann
 

Replies:
Re: Asyn connection/communication management with asynPortDriver Johnson, Andrew N. via Tech-talk
RE: Asyn connection/communication management with asynPortDriver Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: Building an IOC using synApp_6_1 on centos 7. Lang, Keenan C. via Tech-talk
Next: Re: Building an IOC using synApp_6_1 on centos 7. Qing Ma via Tech-talk
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: Building an IOC using synApp_6_1 on centos 7. Qing Ma via Tech-talk
Next: Re: Asyn connection/communication management with asynPortDriver Johnson, Andrew N. via Tech-talk
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
ANJ, 21 Feb 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·