On 08/04/2018 08:43 AM, Johnson, Andrew N. wrote:
> My assumption is that they’re wanting direct access to a large block of data without copying it. This should safe for DB links because of the IOC locking, as long as they aren’t copying pointers out of the dbAddr or using it outside of the locked record that is requesting it, so I could see us adding another API to the LSET that allows that for link types that can provide it.
>
> I would be wary of just handing out the dbAddr* pointer though, since the link could get changed without any notice, so I would like to add a little more enforcement. Some link types could even use this to provide access to their raw data buffers, so I’m wondering about an API like doLocked() where the caller gives us a function pointer which we call back with a dbAddr*.
My thinking has been something like:
> int dbGetPdbAddrFromLink(DBLINK *plink, DBADDR *pout);
which would be used like
> DBLINK *plink = ...;
> DBADDR addr;
> dbScanLock(plink->precord);
> if(dbGetPdbAddrFromLink(plink, &addr)==0) {
> // do something with addr
Though this would look different in the context of an aSub function, the point
is that this avoids returning a pointer to the internal struct dbAddr by making
a copy. This copy remains valid in perpetuity, although the assurance that both
records are covered by the same lock expires as soon as the source record is
unlocked.
- Replies:
- Re: dbGetPdbAddrFromLink dropped from 3.15 again Andrew Johnson
- References:
- dbGetPdbAddrFromLink dropped from 3.15 again Till Straumann
- Re: dbGetPdbAddrFromLink dropped from 3.15 again Michael Davidsaver
- Re: dbGetPdbAddrFromLink dropped from 3.15 again Johnson, Andrew N.
- Navigate by Date:
- Prev:
Re: Delta Tau motor control problem [email protected]
- Next:
Re: dbGetPdbAddrFromLink dropped from 3.15 again 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:
Re: dbGetPdbAddrFromLink dropped from 3.15 again Johnson, Andrew N.
- Next:
Re: dbGetPdbAddrFromLink dropped from 3.15 again 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
|