Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以创建指针DBClientConnection并在多个线程中使用它?
DBClientConnection
connection = new DBClientConnection(); connection->connect("localhost");
然后connection在线程中使用。
connection
同时访问是否安全connection?
不,DBClientConnection 不是线程安全的,不应与多个线程共享。您可能还想检查 ScopedDbConnection,它由连接池支持并在销毁时为您关闭套接字。