I'm writing a module which exports an interface similar to send
and recv
.
Since those functions are supposed to return respectively the number of sent and received bytes, I cannot do proper error management as I would do normally (i.e. using enumeratives and returning mnemonic values).
In a situation like this should I set errno
as the standard library does? If so, since errno
is thread specific, is there a particular way of writing on it, or can I simply assign a value to it?
Edit: experimenting it I noticed that setting errno
by assignment is working. Still: is this safe and portable for any system?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…