A.5 library(broadcast): Broadcast and receive event notifications
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(broadcast): Broadcast and receive event notifications
          • broadcast/1
          • broadcast_request/1
          • listen/2
          • listen/3
          • unlisten/1
          • unlisten/2
          • unlisten/3
          • listening/3
    • Packages
Availability::- use_module(library(broadcast)).(can be autoloaded)
Sourcelisten(+Template, :Goal)
Register a listen channel. Whenever a term unifying Template is broadcasted, call Goal. The following example traps all broadcasted messages as a variable unifies to any message. It is commonly used to debug usage of the library.
?- listen(Term, (writeln(Term),fail)).
?- broadcast(hello(world)).
hello(world)
true.