[Gambas-user] Send a signal do a PID. Is it possible?

Andre Saccomani andre.gambas at ...626...
Thu Nov 17 04:26:41 CET 2005


Thanks for the answer Benoit.

My program is a simple GUI, and send a signal to other running program was
just a Nice to have, and not a Must have.
Regarding the one instance only. I just wanted to prevent the end user to
forget that the program is already in the tray and open it again. So I
wanted to restore the program from tray instead of open a new.
The only one instance issue can be easily work arounded with a little of
bash and EXEC [ ] for READ. :)


Thanks again Benoit.

Andre.

On 11/16/05, Benoit Minisini <gambas at ...1...> wrote:
>
> On Wednesday 16 November 2005 23:50, Andre Saccomani wrote:
> > i
> > Is there anyway to send a signal to a linux PID? and if so, is there a
> way
> > to catch these signals in a gambas application? So when I try to open a
> > second instance of my program, it would check if is there one already
> > running and then it could send a signal to the first instance before
> exit.
> > This signal would cause my program (the first instance) do do a
> > dlgMain.Show, or something like this. restoring it from tray.
> > Hi,
> > I would like to make a software that allows only one instance of it
> > running at same time. So when someone try to open a second instance of
> the
> > program, it would look if there is one already running, and if there is,
> I
> > would like to make this second instance to exit.
> > But before exit, I want it to send a message to the first instance. Is
> > there anyway to do that? send a message to a program by having its PID?
> > If possible, how can I send a message to a PID and how do I handle
> received
> > messages?
> > Thanks in advance,
> > Andre
>
> The problem cannot be solved entirely in Gambas at the moment.
>
> But you first must understand that running a software "once" is more
> subtil on
> Unix than on Windows.
>
> Does "once" means:
> - Only one process for this executable and for one user on the same
> system?
> - Only one process for this executable and for one user on the same
> display/desktop?
>
> With X-Window, processes and displays can have the network between them,
> so
> two processes from two different systems can run on the same desktop, and
> two
> processes from the same system can run on two different desktops.
>
> If your program is a GUI program, running a program "once" usually means:
> only
> one process for this executable for this display/desktop.
>
> KDE solved this problem with the DCOP protocol: the application registered
> to
> the DCOP server, and if it was already registered, then it knows that
> another
> was already started. It can then warn the first application instance with
> a
> DCOP message.
>
> It could be possible to implement this registration by storing an X11
> property
> in the display root window. Then, there will be the problem of sending the
> first registered application that another one was launched. Something to
> implement...
>
> Last point, there is no way to catch signals in a Gambas application.
>
> Regards,
>
> --
> Benoit Minisini
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
> Register for a JBoss Training Course. Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20051117/084963bc/attachment.html>


More information about the User mailing list