Shared connection over multiply threads

前端 未结 1 893
予麋鹿
予麋鹿 2020-12-19 14:07

Is it possible to create pointer of DBClientConnection and use it in multiply threads?

connection = new DBClientConnection();
connection->co         


        
1条回答
  •  醉梦人生
    2020-12-19 14:59

    No. DBClientConnection is not thread safe and should not be shared with more than one thread. You might also want to check ScopedDbConnection, which is backed by a connection pool and closes the socket for you upon destruction.

    0 讨论(0)
提交回复
热议问题