Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • This will introduce a race condition. Must use a mutex. Commented Sep 17, 2018 at 14:45
  • 1
    there's no guarantee that if you spin up two instances at the same time that this will work. Like updating a variable from two different threads. Tricky risky business. Use the force, Luke :) Commented Sep 19, 2018 at 18:12
  • @georgiosd ah I see what you mean. Like if someone start the .exe and changes the name. Yes this would be a way to start it more times, but normaly the .exe does not work, if the name got changed. I will update my answer^^ Thank you Luke :D for pointing that out :) Commented Sep 20, 2018 at 6:43
  • 1
    Not just that @Deniz. If you start two processes really fast, there's a chance that the process list or the method fetching them will execute while there's still only one appearing. This may be an edge case that's irrelevant to you but this being a general question... Commented Sep 26, 2018 at 13:37
  • @georgiosd Can you prove that? Because Iv'e tested it just for you hehe. But it was not possible for me, even really "really fast" ! :P So I can't understand why you belive in something which is just not the case and even dislike this innocent code :D Commented Sep 28, 2018 at 11:40