[gtk-server] Re: busy loop on startup with fifo method
- From: Frantisek Dufka <dufkaf@xxxxxxxxx>
- To: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
- Date: Tue, 17 Apr 2007 16:12:23 +0200
Peter van Eerten wrote:
Well, the first method also could involve a change in the syntax of the
GTK-server, for example:
gtk-server fifo=/tmp/bla nocreate
If that's OK with you then it's easy indeed.
Yes, that would be fine. Thanks.
With the background forking, you do not need the PID, because the call
"gtk_exit" will automatically also exit the GTK-server. Next to this
call you can send a plain "gtk_server_exit" as well.
Ah, I see, it is easy then. Or at least in some situations. I was
thinking about killing gtk-server when there is some error or script is
interrupted via ctrl-c. Just tried it and indeed it doesn't work very
good when hitting ctrl+c. When script is waiting inside gtk
"gtk_server_callback WAIT" and I call another gtk "gtk_exit 0" from trap
handler it does not do the right thing (i.e exit gtk server) it simply
prints error and does nothing
./demo-fifo.sh: 1: cannot create /tmp/gtk-server-fifo.2613: Interrupted
system call
In such cases it may be easier to kill gtk-server directly and the
correct PID is in $! after running gtk-server with & so it is easy. With
gtk server forking to background you would need to hunt it down via ps
and grep. This simple code works as expected
end(){
echo "exiting ..."
kill $SERVER_PID
#gtk "gtk_exit 0"
exit
}
trap 'end' SIGINT
# Start gtk-server
./gtk-server fifo=$PIPE log &
SERVER_PID=$!
Adding some default dialogs would be contradictory to GTK-server logic,
I would say, as it is only a 'gateway' for interpreted languages to the
GTK API. But it should be rather easy to write some simple dialogs using
the built-in dialogs from GTK, like the GtkAboutDialog,
GtkMessageDialog, GtkColorSelectionDialog, GtkFileChooserDialog and so on.
Well it could be meant as another optional layer on top of it for
simplifying some frequent tasks. But if it is easy enough then such
layer is not needed and would add unneeded complexity to gtk-server.
Regards,
Frantisek
- Follow-Ups:
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten
- References:
- [gtk-server] busy loop on startup with fifo method
- From: Frantisek Dufka
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten
- [gtk-server] Re: busy loop on startup with fifo method
- From: Frantisek Dufka
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten
Other related posts:
- » [gtk-server] busy loop on startup with fifo method
- » [gtk-server] Re: busy loop on startup with fifo method
- » [gtk-server] Re: busy loop on startup with fifo method
- » [gtk-server] Re: busy loop on startup with fifo method
- » [gtk-server] Re: busy loop on startup with fifo method
- » [gtk-server] Re: busy loop on startup with fifo method
Well, the first method also could involve a change in the syntax of the GTK-server, for example:
gtk-server fifo=/tmp/bla nocreate If that's OK with you then it's easy indeed.
With the background forking, you do not need the PID, because the call "gtk_exit" will automatically also exit the GTK-server. Next to this call you can send a plain "gtk_server_exit" as well.
Adding some default dialogs would be contradictory to GTK-server logic, I would say, as it is only a 'gateway' for interpreted languages to the GTK API. But it should be rather easy to write some simple dialogs using the built-in dialogs from GTK, like the GtkAboutDialog, GtkMessageDialog, GtkColorSelectionDialog, GtkFileChooserDialog and so on.
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten
- [gtk-server] busy loop on startup with fifo method
- From: Frantisek Dufka
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten
- [gtk-server] Re: busy loop on startup with fifo method
- From: Frantisek Dufka
- [gtk-server] Re: busy loop on startup with fifo method
- From: Peter van Eerten