On Thursday, 4 February 2016 at 06:40:15 UTC, sanjayss wrote:
Are the functions lastSocketError() and wouldHaveBlocked() from
std.socket thread-safe? i.e. can they be reliably used to see
the status of the last socket call when sockets are being
read/written in multiple threads?
Not directly read the code for a while (but did before), those
two functions
call C functions, and they are thread-safe by default. The
WOULD-HAVE-BLOCKED
is understood by checking errno which comes from core.stdc.errno.
If you read
that function's documents, you will see that it is marked as
thread-safe.
http://linux.die.net/man/3/errno
... errno is thread-local; setting it in one thread does not
affect its value in any other thread. ...