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
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits