What do you mean by "Tried using Racket function: filesystem-change-evt but
that did not seem appropriate."? What's inappropriate about it?

My first thought is to initialize a variable with `#f`. Spawn a thread
before the loop that uses `filesystem-change-evt` so that when the event
that you are interested in occurs, mutate the variable to `#t`. In the
loop, break from the loop when the variable is `#t`.

I guess you can also poll `file-exists?` yourself in the thread, with some
`sleep` between each polling.

Related library: https://github.com/zyrolasting/file-watchers/

On Sat, Oct 2, 2021 at 4:25 PM Don Green <infodeveloper...@gmail.com> wrote:

> Looking to trigger the end of a loop by the creation of a file.
> Is this possible? Is this advisable?
> Currently using:
> a 'for' loop with
> a 'for' loop guard expression to test for the existence of a file.
> Tried file-exists? but that does not seem appropriate.
> Tried using Racket function: filesystem-change-evt but that did not seem
> appropriate.
> Is it possible to trigger an end condition on a 'for' loop by the creation
> of a file?
> I suspect my problem is that it takes a significant amount of time for the
> operating system to register the creation of a file.
> So maybe the best that can be done is to use file-exists? as it works but
> there a many loops of the 'for' loop before the end condition takes effect.
> Any comments?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/adaf4e50-7430-4d2e-923a-5a0cdff24ebfn%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/adaf4e50-7430-4d2e-923a-5a0cdff24ebfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcueguT2p_qdN8fAAnxnsYK_E9k5dFcHGD9n9RLNREk-PD7qw%40mail.gmail.com.

Reply via email to