Re: Stopping phix

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's a work-around for what appears to be two copies of phix launched when I run one GTK program. Create a tiny shared library: libpid.so

#include<stdio.h> 
#include<unistd.h> 
int get_pid() 
{ 
  return  getpid() ; 
} 
int get_ppid() 
{ 
  return getppid() ; 
} 

Then, on startup of your program, obtain the pid and ppid (process_id and parent_process_id) by calling these two functions e.g.

constant PID = open_dll("libpid.so") 
integer pid = c_func(define_c_func(PID,"get_pid",{},C_INT) 
integer ppid = c_func(define_c_func(PID,"get_ppid",{},C_INT) 

Then, when your program ends, call

system(sprintf("kill %d %d",{pid,ppid}))

Without this, your graphics remain on screen but unresponsive. Just a guess, but this may have something to do with GTK using threads. Euphoria doesn't "do" threads, so it doesn't have this problem. Maybe that, or something else entirely?

At least, with this patch, your program behaves properly, and cleans up after itself. Now, if I could learn to do that in my workshop...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu