简单的问题 - Perforce线程安全提供的C++ API是什么?文档中没有提到它.
"线程安全"我的意思是来自客户端的服务器请求.显然,如果我有多个线程试图在同一个连接上设置客户端名称,那么就会出现问题.
但是给定一个连接对象,我可以让多个线程获取更改列表,获取状态,通过p4映射翻译文件等吗?
Rap*_*rre 10
迟到的答案,但......从发行说明本身:
已知限制
The Perforce client-server protocol is not designed to support
multiple concurrent queries over the same connection. For this
reason, multi-threaded applications using the C++ API or the
derived APIs (P4API.NET, P4Perl, etc.) should ensure that a
separate connection is used for each thread or that only one
thread may use a shared connection at a time.
Run Code Online (Sandbox Code Playgroud)
它看起来不像客户端对象具有线程亲和性,因此为了共享线程之间的连接,只需使用互斥锁来序列化调用.