How kill a process with its GPid?

View: New views
4 Messages — Rating Filter:   Alert me  

How kill a process with its GPid?

by gege2061 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I create process with g_spawn_async_with_pipes. Is it possible to kill it?

--
Nicolas Joseph

Responsable de la rubrique GTK+ de developpez.com /
In charge of the GTK+ section on developpez.com

http://nicolasj.developpez.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How kill a process with its GPid?

by Tor Lillqvist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I create process with g_spawn_async_with_pipes. Is it possible to kill it?

Not in a cross-platform way. On POSIX, a GPid is just a pid, so use
kill(). On Windows, GPid is a HANDLE for the process, so use
TerminateProcess().

--tml
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How kill a process with its GPid?

by gege2061 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok, thanks :)

Have you planned to add this function? It's a part of bug #142591
(g_pid_terminate).

2008/7/2 Tor Lillqvist <tml@...>:
>> I create process with g_spawn_async_with_pipes. Is it possible to kill it?
>
> Not in a cross-platform way. On POSIX, a GPid is just a pid, so use
> kill(). On Windows, GPid is a HANDLE for the process, so use
> TerminateProcess().
>
> --tml
>



--
Nicolas Joseph

Responsable de la rubrique GTK+ de developpez.com /
In charge of the GTK+ section on developpez.com

http://nicolasj.developpez.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How kill a process with its GPid?

by Tor Lillqvist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Have you planned to add this function? It's a part of bug #142591
> (g_pid_terminate).

I don't think killing a (child) process is necessarily something that
can be usefully wrapped cross-platform. TerminateProcess() is a
somewhat abrupt way to kill a process on Windows (you might want to
send the windows of a GUI process WM_CLOSE messages instead, or
whatever), and on POSIX you might want to send some other signal than
SIGKILL (which is what most closely corresponds to
TerminateProcess()).

--tml
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
LightInTheBox - Buy quality products at wholesale price