Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

singleton

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick C - 23 Apr 2007 00:29 GMT
Hi

I would like to implement a Systemwide singleton in .net. Is it sensible to
use a mutex for this? The application only can be run by one user at the
time.  Does anyone have any articles/samples that can help me with this
problem?

thanks

N
Michael Nemtsev - 23 Apr 2007 09:10 GMT
Hello Nick,

Seems that u mix it up a liitle bit
Singleton allows you to create only one instance of the specific class: http://dofactory.com/Patterns/PatternSingleton.aspx
If you want to have to start the single copy of the application you need
to use global mutex:  http://msdn2.microsoft.com/en-us/library/system.threading.mutex.aspx

---
WBR,  Michael  Nemtsev [.NET/C# MVP].  
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

NC> would like to implement a Systemwide singleton in .net. Is it
NC> sensible to use a mutex for this? The application only can be run by
NC> one user at the time. Does anyone have any articles/samples that can
NC> help me with this problem?
NC>
Murdoc - 04 Jun 2007 22:12 GMT
> Hi
>
> I would like to implement a Systemwide singleton in .net. Is it sensible to use a mutex for this? > The application only can be run by one user at the time.  

What exactly do you mean by this?

1. Only allow a single instance (regardless of the user) to be loaded per machine
2. Only a single instance can be running at a time regardless of the machine
3. Only allow a given user to be executing a single instance of your application on a given machine; or
4. Only allow a given user to be executing a single instance of your application, regardless of machine.

Only the first one is really achievable with a Mutex.
The other two would require some form of database record and/or control file to be used.

--

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.