Skip to content

Create an EventManager class in context transport primitives #208

@lukemartinlogan

Description

@lukemartinlogan

@AGENTS.md

Create an EventManager class in context transport primitives. I want to migrate all OS-dependent code to the context transport primitives as much as possible. This task focuses on abstracting signals and epoll.

struct Event {
  int fd_;  // Linux
};

class EventManager {
  // Add a custom event like a file descriptor for waiting for I/O competions, etc.
  void AddEvent(const Event &event);
  // Signal process awake
  void Signal(int pid);
  // Poll until event or re-awaken after 
  void PollFor(u32 usec);
}

This is essentially a wrapper around epoll.
On Linux, the EventManager allows for custom events to be registered.
By default, there will be an event for "re-awakening". This is equivalent to our signaling code with SIG_USR1 we had in the IpcManager. That should be moved here.
This class should automatically create an epoll file descriptor and a signal fd. This code should be removed from Worker and placed here. Worker should use this class instead. Same for the IpcManager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions