1

Concurrent reads from sctp socket are thread safe. SCTP stack probably uses some synchronization primitive (e.g. mutex) to achieve it. My question is if the (sctp) socket is placed in non-blocking mode. Will the read return if sctp code could not get lock immediately or it only blocks when buffers at socket are full.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Ittium
  • 21
  • 3

1 Answers1

1

If the socket is in non-blocking mode it should block until the mutex is acquired, then do whatever the current buffer state dictates that recvmsg() should do, then return. As none of that blocks, it doesn't matter that the mutex blocks for an instant. It's no different from the same situation with TCP or UDP. The non-blocking contract is to not block waiting for data.

user207421
  • 305,947
  • 44
  • 307
  • 483