more event combinators
play

More Event Combinators CML provides two more event combinators: guard - PowerPoint PPT Presentation

More Event Combinators CML provides two more event combinators: guard and withNack : val guard : (unit -> a event) -> a event val withNack : (unit event -> a event) -> a event Each time an event involving guard f is


  1. More Event Combinators CML provides two more event combinators: guard and withNack : val guard : (unit -> ’a event) -> ’a event val withNack : (unit event -> ’a event) -> ’a event Each time an event involving guard f is synchronized on, guard f is replaced by f () , which is then processed further. guard may be used, e.g., to generate a fresh reply channel each time an event is synchronized on. 1

  2. More Event Combinators (Cont.) val guard : (unit -> ’a event) -> ’a event val withNack : (unit event -> ’a event) -> ’a event Each time an event involving withNack f is synchronized on, withNack f is replaced by f nev , which is then processed further, where nev is a fresh negative acknowledgment unit event that will become enabled if some event other than f nev is selected in the synchronization. For example, if choose [ ev , withNack f ] is synchronized on, but ev is eventually selected, then the negative acknowledgment event nev passed to f will become enabled, indicating that any operation begun by f nev should be aborted. 2

  3. More Event Combinators (Cont.) val guard : (unit -> ’a event) -> ’a event val withNack : (unit event -> ’a event) -> ’a event Each time an event involving withNack f is synchronized on, withNack f is replaced by f nev , which is then processed further, where nev is a fresh negative acknowledgment unit event that will become enabled if some event other than f nev is selected in the synchronization. For example, if choose [ ev , withNack f ] is synchronized on, but ev is eventually selected, then the negative acknowledgment event nev passed to f will become enabled, indicating that any operation begun by f nev should be aborted. The guard functions of guard ’s and withNack ’s should run quickly; in particular, they shouldn’t block. 2-a

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend