简体   繁体   English

调用recvfrom()和setsockopt()从不同线程添加/离开多播成员资格

[英]Calling recvfrom() and setsockopt() to add/leave multicast membership from different threads

I have one thread calling recvfrom() and another thread calling setsockopt() to add/leave multicast membership. 我有一个线程调用recvfrom(),另一个线程调用setsockopt()添加/离开多播成员资格。 Is that thread safe or both functions need to be called from the same thread? 该线程安全吗,还是需要从同一线程调用这两个函数?

These are both system calls, not library functions, so it is safe to call them from different threads. 这些都是系统调用,而不是库函数,因此可以安全地从不同的线程调用它们。

Whether a join/leave will affect a concurrent recvfrom() that has already started is a moot question. 一个连接/离开是否会影响已经开始的并发recvfrom()是一个有争议的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM