Skip to content

Refactoring event codes with respect to recent changes #492

Description

@alexcrichton

Currently we have:

class EventCode(IntEnum):
  NONE = 0
  CALL_STARTING = CallState.STARTING
  CALL_STARTED = CallState.STARTED
  CALL_RETURNED = CallState.RETURNED
  STREAM_READ = 5
  STREAM_WRITE = 6
  FUTURE_READ = 7
  FUTURE_WRITE = 8

Additionally the callback for async lifted exports receives three 32-bit integers at this time: an EventCode, an optional waitable index, and an optional code for the event.

With futures/streams there's currently a nice property that for any waitable there's a single EventCode that corresponds to it, for example the two reads of a stream/future have a read/write event. Additionally the optional code to the callback exactly corresponds to what the read/write/cancel intrinsics all return.

For subtasks, however, the three events a subtask can receive are split across different EventCodes where the optional code for each event is always zero.

How about refactoring these codes/states with respect to the upcoming change of two-handle streams/futures? The idea would be to fold CALL_* into a single EventCode.SUBTASK. The waitable index to the callback would be the same and the optional code would be the CallState.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions