realbasic-nug
[Top] [All Lists]

Re: Multiple app instances

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Multiple app instances
From: Aaron Ballman <aaron at realsoftware dot com>
Date: Sun, 30 Jan 2005 13:58:28 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <41FCCE58 dot 6050807 at adinet dot com dot uy> <070b67f3b8870a0bd4a3f5c28aa45b65 at shaw dot ca> <E0053C84-72F7-11D9-82F2-00039378202C at realsoftware dot com> <946ec09fc3bbef9d68a9ec25fa53cc97 at shaw dot ca>
Sorta. You make a named mutex which is a system-wide object that any application can access. You then obtain the mutex (much the same way you would Enter a critical section or Signal a semaphore). If you aren't able to obtain a lock on the mutex, then you know some other instance of your application is running on the same machine. There's no hand-off involved -- it's just another type of locking mechanism.


OK ...
Suppose that an instance of this app is already running and a second instance is started to open another document. If there's no hand off to get the first running instance to open that document that the the new second instance should have the second simply dies when it sees that there is already one running and the document is not opened.

Mutexes have next-to-nothing to do with the above scenario (aside from the obvious detection of the second application running).

If you want to handle the above situation, then you should use an IPCSocket to tell the other application which document to open (though any communication mechanism will work, such as TCPSocket, AppleEvents [on the Mac, obviously] or even UDPSockets).

HTH!

~Aaron
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>