:: Re: [DNG] Doing away with multi-thr…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Edward Bartolo
Päiväys:  
Vastaanottaja: tilt!, dng
Aihe: Re: [DNG] Doing away with multi-threading in my project (netman)
Hi,

For the last days I have been struggling to reap zombies adopted by
the frontend with only failures. I tried several methods using
wait(-1), waidpid and trapping the signal when a child dies without
ever succeeding to reap zombies. This means, I will stop and will
leave the issue open to anyone who can find a working solution. With
zombies or not, the application works. So I will continue with real
development instead of fighting a seeming impossible battle.

The pascal code that I used to reap zombies:
======================================
procedure handle_sigchld(sig: longint; info: psiginfo; context:
psigcontext); cdecl;
var
  Status: cint;
  a_pid: pid_t;
begin
  Status := 0;
  a_pid := -1;
{
  SIGCHLD
  CLD_EXITED     child has exited
  CLD_KILLED     child was killed
  CLD_DUMPED     child terminated abnormally
  CLD_TRAPPED     traced child has trapped
  CLD_STOPPED     child has stopped
  CLD_CONTINUED     stopped child had continued
}


  //CLD_EXITED = 1; CLD_KILLED = 2
  if info^.si_code = 2 then
  begin
    backend_lives := backend_lives + 1;
    //fpwaitpid(a_pid, Status, WNOHANG);
    //fpwaitpid(info^._sifields._sigchld._pid,
info^._sifields._sigchld._status, WNOHANG);
    //fpwait(info^._sifields._sigchld._pid); //,
info^._sifields._sigchld._status, WNOHANG);
    //info^._sifields._sigchld._pid:=;
    //while fpwait(a_pid) > 0 do;


    s := s + inttostr(info^.si_code) + '.';


{  while (fpwaitpid(a_pid, Status, WNOHANG) > 0) do
  begin
    backend_lives := backend_lives + 1;
   end; }
  end;



end;


var sa: sigactionrec;

initialization

sa.sa_handler := @handle_sigchld;
fpsigemptyset(&sa.sa_mask);

  sa.sa_flags := (SA_RESTART or SA_NOCLDSTOP);
  if (fpsigaction(SIGCHLD, @sa, nil) = -1) then
  begin
    // do nothing
  end;


======================================


Edward

On 03/09/2015, poitr pogo <lepoitr@???> wrote:
> hmm, I do wifi connect in bash/xterm
>
> one shot
> sudo vi /etc/network/interfaces
> add
>
> source /etc/network/interfaces.d/*.cfg
>
> if not already there
>
> make sure /etc/network/interfaces.d folder exists
>
> later, check what is available
>
> sudo iwlist wlan0 scanning |grep -e ESSID -e Quality
>                     Quality=70/70  Signal level=-40 dBm
>                     ESSID:"apn 1"

>
> If never used one before
>
> sudo /etc/network/interfaces.d/apn_1.cfg
>
> iface apn_1 inet dhcp
>     wpa-ssid "apn 1"
>     wpa-psk mypass1234

>
>
> from now on to connect to "apn 1" I just do
>
> sudo ifup wlan0=apn_1
>
>
> --
>
> regards
> piotr
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>