[lldb-dev] ConnectionFileDescriptor and thread safety

Zachary Turner zturner at google.com
Thu Oct 2 14:22:29 PDT 2014


What are the thread safety assumptions of ConnectionFileDescriptor?
There's a mutex in ConnectionFileDescriptor::Read(), but it almost seems
pointless.  All it does is do a TryLock() and then return an error if it
fails.  I sincerely doubt anyone is actually handling this error, so this
implies to me that it's intended to not be used concurrently from multiple
threads and this is just used to catch the error in case anyone messes up.

But this leads to something else that I don't understand.  Do we actually
care to support regular on-disk files with this class, or do we only care
about sockets and pipes?  We do seem to have support for a file://PATH
connection string, so someone thinks this is useful.  But how would it even
work without being able to either seek or specify the offset?  Are you
expected to use a different fd for the reading and writing side and never
mix calls to Read() and Write() on the same Connection instance?  If so,
maybe we need to make this explicit with InboundConnection and
OutboundConnection or something like that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20141002/059699bd/attachment.html>


More information about the lldb-dev mailing list