1Event::MakeMaker(3)   User Contributed Perl Documentation  Event::MakeMaker(3)
2
3
4

NAME

6       Event::MakeMaker - MakeMaker glue for the C-level Event API
7

SYNOPSIS

9       This is an advanced feature of Event.
10

DESCRIPTION

12       For optimal performance, hook into Event at the C-level.  You'll need
13       to make changes to your "Makefile.PL" and add code to your "xs" / "c"
14       file(s).
15

WARNING

17       When you hook in at the C-level you get a huge performance gain, but
18       you also reduce the chances that your code will work unmodified with
19       newer versions of "perl" or "Event".  This may or may not be a problem.
20       Just be aware, and set your expectations accordingly.
21

HOW TO

23   Makefile.PL
24         use Event::MakeMaker qw(event_args);
25
26         # ... set up %args ...
27
28         WriteMakefile(event_args(%args));
29
30   XS
31         #include "EventAPI.h"
32
33         BOOT:
34           I_EVENT_API("YourModule");
35
36   API (v21)
37        struct EventAPI {
38           I32 Ver;
39
40           /* EVENTS */
41           void (*queue   )(pe_event *ev);
42           void (*start   )(pe_watcher *ev, int repeat);
43           void (*now     )(pe_watcher *ev);
44           void (*stop    )(pe_watcher *ev, int cancel_events);
45           void (*cancel  )(pe_watcher *ev);
46           void (*suspend )(pe_watcher *ev);
47           void (*resume  )(pe_watcher *ev);
48
49           /* All constructors optionally take a stash and template.  Either
50             or both can be NULL.  The template should not be a reference. */
51           pe_idle     *(*new_idle  )(HV*, SV*);
52           pe_timer    *(*new_timer )(HV*, SV*);
53           pe_io       *(*new_io    )(HV*, SV*);
54           pe_var      *(*new_var   )(HV*, SV*);
55           pe_signal   *(*new_signal)(HV*, SV*);
56
57           /* TIMEABLE */
58           void (*tstart)(pe_timeable *);
59           void (*tstop)(pe_timeable *);
60
61           /* HOOKS */
62           pe_qcallback *(*add_hook)(char *which, void *cb, void *ext_data);
63           void (*cancel_hook)(pe_qcallback *qcb);
64
65           /* STATS */
66           void (*install_stats)(pe_event_stats_vtbl *esvtbl);
67           void (*collect_stats)(int yes);
68           pe_ring *AllWatchers;
69
70           /* TYPEMAP */
71           SV   *(*watcher_2sv)(pe_watcher *wa);
72           void *(*sv_2watcher)(SV *sv);
73           SV   *(*event_2sv)(pe_event *ev);
74           void *(*sv_2event)(SV *sv);
75        };
76
77   EXAMPLE
78         static pe_io *X11_ev=0;
79
80         static void x_server_dispatch(void *ext_data)
81         { ... }
82
83         if (!X11_ev) {
84           X11_ev = GEventAPI->new_io(0,0);
85           X11_ev->poll = PE_R;
86           sv_setpv(X11_ev->base.desc, "X::Server");
87           X11_ev->base.callback = (void*) x_server_dispatch;
88           X11_ev->base.ext_data = <whatever>;
89           X11_ev->base.prio = PE_PRIO_NORMAL;
90         }
91         X11_ev->fd = x_fd;
92         GEventAPI->resume((pe_event*) X11_ev);
93         GEventAPI->start((pe_event*) X11_ev, 0);
94
95   BUT I NEED A NEW TYPE OF WATCHER FOR MY INTERGALACTIC INFEROMETER
96       I'd prefer not to export the entire Event.h apparatus in favor of
97       minimizing interdependencies.  If you really, really need to create a
98       new type of watcher send your problem analysis to the mailing list!
99
100
101
102perl v5.34.0                      2021-07-22               Event::MakeMaker(3)
Impressum