Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mutex Question

Started by omyn Apr 19, 2006 at 1:01 AM 1 replies 450+ views
Original Post
omyn
omyn
I need to use a mutex and I'm programming in .net. I learned how to use a mutex on a linux box and it doesnt look like my knowledge carries over to a windows box. Im curious if there is a preferred mutex class in windows? (that is if there even is a variety of mutex) thanks for ur help
KulSeran
KulSeran
In windows you can use
CreateMutex() to make a mutex
WaitForSingleObject() to lock a mutex
ReleaseMutex() to release the mutex
(edit note) Missed .net, just saw "windows". These functions are the the old Win32 API calls, not .net. :(
The overall program structure should be no different from what you would do in linux.

You could also download the pthread libraries, and have the same POSIX standard threads from linux in your windows programs.
Washu
Washu
If you are using .Net then you can look at the System.Threading.Mutex class, however if you don't need to share it across processes then you can simply use the Monitor class to perform synchronization (lock(){} construct C#).
In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.