c++ - Concurrent system calls in Linux -
simple question is, haven't found googling. safe make concurrent calls linux system, such calling socket()
on several threads @ (what might be) same time? specifically, kernel guarantee thread-safety socket()
, connect()
, and/or send()
?
if not, why not? i'd learn more topic , why system calls or not thread-safe.
my main concern here socket()
not return duplicate or invalid file descriptor when called different threads. i'm not going connecting or writing same socket @ same time in case.
is safe make concurrent calls linux system, such calling socket() on several threads @ (what might be) same time?
yes, thread safe. though not sure per posix standard or not.
specifically, kernel guarantee thread-safety socket(), connect(), and/or send()?
as per this link, yes. says locks used internally, mean send
operation serialized, not in specific order.
answer updated part of question:
my main concern here socket() not return duplicate or invalid file descriptor when called different threads.
no worries here. os make sure file descriptors socket not duplicated.
Comments
Post a Comment