[Gambas-user] How to stop a gb.inotify watch

Jussi Lahtinen jussi.lahtinen at gmail.com
Fri Oct 29 20:18:10 CEST 2021


Do not use "wait" inside of an event handler (undefined behaviour). Use
sleep instead.

Jussi

On Fri, Oct 29, 2021 at 8:32 PM <james at lixce.com> wrote:

> In my gb.qt5.webview  based web browser I'm starting a file watch with:
>
> wchLink = New Watch("/tmp/Cntrl_lixce-nexus", True) As "extCntl"
>
> and then monitor for other programs to write a URL to that file.
>
> Everything works great but I cannot figure out how to stop the watch so
> that I can close the program gracefully. Tried using a pipe instead but it
> slows the browser to an absolute crawl, and I am avoiding dbus.
>
> I was using:
>
> Public Sub Form_Close()
>   Try Kill "/tmp/Cntrl_lixce-nexus"  'segfaults with or without this line
>   Wait
>   Quit
> End
>
> Which effectively forces the program to exit but it is very ugly ending in
> a segfault.
>
> I'm currently using:
>
> Public Sub Form_Close()
>   Try Kill "/tmp/Cntrl_lixce-nexus"
>   Wait
>   Exec ["kill", Application.Id]
> End
>
> Which is a little more graceful (no segfault) but is still pretty ugly.
>
> The inotify man 7 page shows an "inotify_rm_watch" command but I don't
> know of any way to call it from Gambas.
>
> Any insight would be greatly appreciated.
>
> J. Jordan
>
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211029/88f30ac5/attachment.htm>


More information about the User mailing list