[Lldb-commits] [PATCH] D56231: [lldb-server] Improve support on Windows

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 7 10:14:47 PST 2019


zturner added inline comments.


================
Comment at: source/Host/common/File.cpp:606-607
 #else
     long cur = ::lseek(m_descriptor, 0, SEEK_CUR);
+    SeekFromStart(offset);
     error = Write(buf, num_bytes);
----------------
Be careful here.  `pwrite` on posix is atomic, which means that if multiple threads both use `pwrite` at different offsets, there is no race condition.    The only way to do a similar atomic write-at-offset on Windows is with overlapped i/o., and it's a completely different API / interface.

I mention this because in a previous review Pavel suggested to change `lldb-server` to spawn 1 thread / connection instead of 1 process / connection, so this can be a real problem in such a scenario if they are racing for the same file.  Probably they won't be, since each connection will use different output files, but we should at least be aware of (and perhaps document) the different in atomicity semantics here.

Alternatively, we could just err on the side of safety and put this in a mutex.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56231/new/

https://reviews.llvm.org/D56231





More information about the lldb-commits mailing list