I haven’t been able to find a nice way to start a named thread at the beginning of a single prolog file. I have been starting a thread in a single file using initialize/2, catch/3, setup_call_cleanup/3 and etc. , I could report a few weird behaviours when using these… but these weird behaviours cause problems (that can be fixed) only in development phase while doing test/re-edit/make cycles.
The named thread is doing things like watching changes in file system, polling these changes, so it is like a side-effect
Now I realized that the nicest way is to start a thread in a specific dedicated module and in main module use that module with use_module/3 Am I right?? Putting the named thread in a separate module, start it there and use that module in test/edit/make-cycle and make/0 takes care of things nicely??? But that is also sort of clumsy.
The initialization directive could have some option to start a named thread and ignore that it exists while doing test/edit/make cycles??