开发者

Multiple-instances lock?

开发者 https://www.devze.com 2022-12-12 15:03 出处:网络
I am using a mysql db. Right now for my multithreads i use lock(staticVar){...}. It works fine. But i can add data via the command line which also uses the DB. It will occasionally throw an e开发者_运

I am using a mysql db. Right now for my multithreads i use lock(staticVar){...}. It works fine. But i can add data via the command line which also uses the DB. It will occasionally throw an e开发者_运维知识库xception or cause my main instance to throw an exception from the sqlite db being lock.

How can i create a mutli instance lock so i no longer get this db is locked exception?


For interprocess lock use global Mutex class: link

0

精彩评论

暂无评论...
验证码 换一张
取 消