Event::MakeMaker(3)
π Event::MakeMaker π
okay bestie, so this is the manual page for Event::MakeMaker(3) β the MakeMaker glue for the C-level Event API β and we're gonna get into it β¨
πΈ NAME πΈ
Event::MakeMaker β MakeMaker glue for the C-level Event API π«Ά
β¨ SYNOPSIS β¨
This is an advanced feature of Event. Like, advanced advanced. Head's up π
π DESCRIPTION π
So for optimal performance, you hook into Event at the C-level. Iconic, but it means you'll need to make changes to your Makefile.PL and add code to your xs / c file(s). No cap, that's the whole vibe.
π¨ WARNING π¨
When you hook in at the C-level you get a huge performance gain, but you also reduce the chances that your code will work unmodified with newer versions of perl or Event. This may or may not be a problem. Just be aware, and set your expectations accordingly. Like, don't come crying to me if your code breaks on the next perl release, okay? π
π οΈ HOW TO π οΈ
π Makefile.PL π
use Event::MakeMaker qw(event_args);
# ... set up %args ...
WriteMakefile(event_args(%args));
π¦ XS π¦
#include "EventAPI.h"
BOOT:
I_EVENT_API("YourModule");
π API (v21) π
here's the whole struct, bestie β every field, every comment, exactly as it is:
struct EventAPI {
I32 Ver;
/* EVENTS */
void (*queue )(pe_event *ev);
void (*start )(pe_watcher *ev, int repeat);
void (*now )(pe_watcher *ev);
void (*stop )(pe_watcher *ev, int cancel_events);
void (*cancel )(pe_watcher *ev);
void (*suspend )(pe_watcher *ev);
void (*resume )(pe_watcher *ev);
/* All constructors optionally take a stash and template. Either
or both can be NULL. The template should not be a reference. */
pe_idle *(*new_idle )(HV*, SV*);
pe_timer *(*new_timer )(HV*, SV*);
pe_io *(*new_io )(HV*, SV*);
pe_var *(*new_var )(HV*, SV*);
pe_signal *(*new_signal)(HV*, SV*);
/* TIMEABLE */
void (*tstart)(pe_timeable *);
void (*tstop)(pe_timeable *);
/* HOOKS */
pe_qcallback *(*add_hook)(char *which, void *cb, void *ext_data);
void (*cancel_hook)(pe_qcallback *qcb);
/* STATS */
void (*install_stats)(pe_event_stats_vtbl *esvtbl);
void (*collect_stats)(int yes);
pe_ring *AllWatchers;
/* TYPEMAP */
SV *(*watcher_2sv)(pe_watcher *wa);
void *(*sv_2watcher)(SV *sv);
SV *(*event_2sv)(pe_event *ev);
void *(*sv_2event)(SV *sv);
};
π EXAMPLE π
look at this little guy go β X11 watcher setup, fresh out the oven:
static pe_io *X11_ev=0;
static void x_server_dispatch(void *ext_data)
{ ... }
if (!X11_ev) {
X11_ev = GEventAPI->new_io(0,0);
X11_ev->poll = PE_R;
sv_setpv(X11_ev->base.desc, "X::Server");
X11_ev->base.callback = (void*) x_server_dispatch;
X11_ev->base.ext_data = <whatever>;
X11_ev->base.prio = PE_PRIO_NORMAL;
}
X11_ev->fd = x_fd;
GEventAPI->resume((pe_event*) X11_ev);
GEventAPI->start((pe_event*) X11_ev, 0);
π§ BUT I NEED A NEW TYPE OF WATCHER FOR MY INTERGALACTIC INFEROMETER π§
I'd prefer not to export the entire Event.h apparatus in favor of minimizing interdependencies. If you really, really need to create a new type of watcher send your problem analysis to the mailing list! π«Ά
fr fr, that's the whole page. advanced C-level Event stuff, huge performance gains, some risk, and a whole lot of struct fields. slay π
kisses, bestie β this was Event::MakeMaker(3) from perl v5.42.0, dated 2021-04-30 πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms