NAME

Hypersonic::Event::Kqueue - kqueue event backend for BSD/macOS

SYNOPSIS

use Hypersonic::Event;

my $backend = Hypersonic::Event->backend('kqueue');
# $backend is 'Hypersonic::Event::Kqueue'

DESCRIPTION

Hypersonic::Event::Kqueue is the kqueue-based event backend for Hypersonic. It is native to BSD-derived systems including macOS.

kqueue provides efficient O(1) event notification similar to Linux's epoll, making it ideal for high-performance servers.

METHODS

name

my $name = Hypersonic::Event::Kqueue->name;  # 'kqueue'

Returns the backend name.

available

if (Hypersonic::Event::Kqueue->available) { ... }

Returns true if this backend is available (BSD/macOS only).

includes

Returns the C #include directives needed for kqueue.

defines

Returns the C #define directives for kqueue configuration.

event_struct

my $struct = Hypersonic::Event::Kqueue->event_struct;  # 'kevent'

Returns the C struct name used for the events array.

gen_create($builder, $listen_fd_var)

Generates C code to create a kqueue instance and register the listen socket.

gen_add($builder, $loop_var, $fd_var)

Generates C code to add a file descriptor to the kqueue.

gen_del($builder, $loop_var, $fd_var)

Generates C code to remove a file descriptor from the kqueue.

gen_wait($builder, $loop_var, $events_var, $count_var, $timeout_var)

Generates C code to wait for events with a timeout.

gen_get_fd($builder, $events_var, $index_var, $fd_var)

Generates C code to extract the file descriptor from an event.

AVAILABILITY

macOS (darwin), FreeBSD, OpenBSD, NetBSD.

SEE ALSO

Hypersonic::Event, Hypersonic::Event::Role, Hypersonic::Event::Epoll

AUTHOR

LNATION <email@lnation.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.