Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extendselectors module to support platform-specific events #144211

Open
Labels
extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement
@giampaolo

Description

@giampaolo

Theselectors module API is deliberately very narrow:

  • Theregister() /modify() methods only acceptevents as a bitmask ofEVENT_READ |EVENT_WRITE
  • Theselect() method only ever returns combinations ofEVENT_READ |EVENT_WRITE

This design makes it impossible to use many platform-specific events provided by the underlying OS APIs (poll,epoll,kqueue). For example,#79698 describes a use case forEPOLLEXCLUSIVE on Linux. The biggest missed opportunity, however, is the inability to fully exploitkqueue() on BSD / macOS, which would allow async handling of regular files, signals, and others (seeKQ_EVENT_*).

This limitation is relevant forasyncio, which uses theselectors module. For instance, on BSD / macOS,asyncio could be notified when a process terminates, enabling an optimization similar to#144047. Currenlyasyncio on Linux already takes advantage of this approach viaos.pidfd_open() +selectors.PollSelector (seesource), but can't do the same for BSD / macOS becauseselectors.KqueueSelector doesn't allow registering customselect.kevent() objects.

Whereas it would be relatively easy to add aregister_kevent() method, or to passEPOLL* events directly toregister(), it's less clear how theselect() method should behave in this case, since it's apparently bound to the promise of returning eitherEVENT_READ orEVENT_WRITE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp