开发者

Synchronization between two processes in C#.?

开发者 https://www.devze.com 2022-12-12 05:28 出处:网络
Is there any way so th开发者_如何学Pythonat we can synchronize two independent processes? Like if they are sharing a resource, I would like to sync them.

Is there any way so th开发者_如何学Pythonat we can synchronize two independent processes? Like if they are sharing a resource, I would like to sync them.

I am using C#.


you can use the Mutex class

see documentation here : http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx


You can use WCF with pipe binding, or named synchronization objects, Mutex for example for synchronization between two processes


Mutexes will give you cross process sync.

You could also implement an API in WCF using named pipes, which could give you a nice synchronisation in OO code without system calls and it fully unit testable. Named pipes would also give you not just sync but communication as well.

0

精彩评论

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