Add interrupt masking primitives#359
Draft
abelstuker wants to merge 12 commits intoTOPLLab:mainfrom
Draft
Conversation
Contributor
Author
|
Note: the current PR defines primitive globals, resulting in CI errors as described in #357, and can therefore only pass CI when this issue is resolved and the corresponding changes are merged into this branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces interrupt masking primitives.
Concretely, the functions
mask_interruptsandunmask_interruptsare exposed as primitives to the source program.These allow the developer to temporarily disable or discard events during critical sections of the code.
Two types of masking behaviour exist:
mask_interrupts): prevent events from being queuedmask_interrupts): allow events to enqueue, but block resolution until unmaksedMasks are identified and distinguished by their key, returned by the
mask_interruptsfunction. This key must be used to later callunmask_interrupts. This allows for multiple (nested) masks to exist at the same time.Events are now grouped by
EventGroups (INTERRUPT_EVENT,MQTT_EVENT). These groups are also exposed asi32primitive globals (event_group_interruptorevent_group_mqtt, and additionallyevent_groups_all), so they can be used in themask_interruptscall to selectively disable one or all groups of events.An example can be found in tutorials/wat/main/interrupt_masking.wast.