多线程并发访问和全局互斥锁
Concurrent access by multiple threads and global mutex
OpenSSL 常见问题解答声明它可以在线程应用程序中使用:
1. Is OpenSSL thread-safe?
Provided an application sets up the thread callback functions, the answer is yes.
此回调函数指的是全局 SSL 锁,因此如果您有 2 个 ssl 连接 运行 它们都将使用此全局锁。
但是常见问题解答仍在继续:
There are limitations; for example, an SSL connection cannot be used concurrently by multiple threads. This is true for most OpenSSL objects.
这表示每个 SSL 连接都需要一个额外的互斥锁。这个对吗?还是我不需要为每个 SSL 连接添加额外的互斥量?
这意味着如果你的连接被多个线程共享,你需要有一个互斥锁来避免它们同时操作连接。
只要任何单个连接一次仅被一个线程使用(在大多数应用程序中是正常情况),您就不需要任何进一步的锁定。
OpenSSL 常见问题解答声明它可以在线程应用程序中使用:
1. Is OpenSSL thread-safe?
Provided an application sets up the thread callback functions, the answer is yes.
此回调函数指的是全局 SSL 锁,因此如果您有 2 个 ssl 连接 运行 它们都将使用此全局锁。
但是常见问题解答仍在继续:
There are limitations; for example, an SSL connection cannot be used concurrently by multiple threads. This is true for most OpenSSL objects.
这表示每个 SSL 连接都需要一个额外的互斥锁。这个对吗?还是我不需要为每个 SSL 连接添加额外的互斥量?
这意味着如果你的连接被多个线程共享,你需要有一个互斥锁来避免它们同时操作连接。
只要任何单个连接一次仅被一个线程使用(在大多数应用程序中是正常情况),您就不需要任何进一步的锁定。