Re: [GD-Windows] Limiting to one instance
Brought to you by:
vexxed72
From: Richard M. <mi...@tr...> - 2006-08-16 07:48:16
|
http://support.microsoft.com/default.aspx?scid=kb;en-us;106385 I guess it is an officially recommended technique. A mutex is a proper kernel object, so should be pretty safe. -- ()() Richard Mitton ( '.') (")_(") code jester .:. treyarch .:. mi...@tr... On 16 Aug 2006, at 12:37 am, Alen Ladavac wrote: > Jon wrote: >> Using FindWindow() introduces a possible race condition > > I stand corrected. I was using this for installers, not for actually > preventing double-startup of the same app. So scratch my remark on > FindWindow being useful here. > > Stefan wrote: >> But CreateMutex etc *is* intended for the purpose. > > Well, I was replying to Andrew's comment on IP ports not being > suitable for that purpose. In that context, I believe CreateMutex is > not any more suitable. CreateMutex (named) is intended for the purpose > of synchronizing two processes by actually using a mutex. Using the > mutex's mere existance to note anything is as much of a hack as using > an IP port for that. The fact that there are personal firewalls in the > modern world is another hack as well. IP port creation was not > supposed to be intercepted in this way - in the original design, > AFAIK. > > Simply trying to point out the fact that we frequently have to use > something for what it is not supposed to be used for. And often one > can't predict all possible side-effects. Like that poor guy didn't > predict that a firewall would make the IP-port solution useless, like > FindWindow is not perfect due to a possible race condition, like the > CreateMutex might have possible user-switching problem (although not > likely, as local creation is default, IIRC). > > Put simply: unless the manual says "this can be used to do XYZ", then > if you are using it for that, you are risking possible problems. > (Although, you are probably risking possible problems even if it does > say so. :p ) > > JM2C, > Alen > > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 |