ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/MakeMaker.pm
Revision: 1.11
Committed: Thu Oct 30 09:57:01 2008 UTC (15 years, 7 months ago) by root
Branch: MAIN
CVS Tags: rel-4_802
Changes since 1.10: +1 -1 lines
Log Message:
4.802

File Contents

# Content
1 package Coro::MakeMaker;
2
3 BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") }
4
5 use Config;
6 use base 'Exporter';
7
8 our $VERSION = 4.802;
9
10 @EXPORT_OK = qw(&coro_args $installsitearch);
11
12 my %opt;
13
14 for my $opt (split /:+/, $ENV{PERL_MM_OPT}) {
15 my ($k,$v) = split /=/, $opt;
16 $opt{$k} = $v;
17 }
18
19 my $extra = $Config{sitearch};
20
21 $extra =~ s/$Config{prefix}/$opt{PREFIX}/ if
22 exists $opt{PREFIX};
23
24 for my $d ($extra, @INC) {
25 if (-e "$d/Coro/CoroAPI.h") {
26 $installsitearch = $d;
27 last;
28 }
29 }
30
31 sub coro_args {
32 my %arg = @_;
33 $arg{INC} .= " -I$installsitearch/Coro";
34 %arg;
35 }
36
37 1;
38 __END__
39
40 =head1 NAME
41
42 Coro::MakeMaker - MakeMaker glue for the C-level Coro API
43
44 =head1 SYNOPSIS
45
46 This allows you to control coroutines from C level.
47
48 =head1 DESCRIPTION
49
50 For optimal performance, hook into Coro at the C-level. You'll need
51 to make changes to your C<Makefile.PL> and add code to your C<xs> /
52 C<c> file(s).
53
54 =head1 WARNING
55
56 When you hook in at the C-level you get a I<huge> performance gain,
57 but you also reduce the chances that your code will work unmodified
58 with newer versions of C<perl> or C<Coro>. This may or may not be a
59 problem. Just be aware, and set your expectations accordingly.
60
61 =head1 HOW TO
62
63 =head2 Makefile.PL
64
65 use Coro::MakeMaker qw(coro_args);
66
67 # ... set up %args ...
68
69 WriteMakefile(coro_args(%args));
70
71 =head2 XS
72
73 #include "CoroAPI.h"
74
75 BOOT:
76 I_CORO_API("YourModule");
77
78 =head2 API
79
80 #define CORO_TRANSFER(prev,next) /* transfer from prev to next */
81 #define CORO_SCHEDULE /* like Coro::schedule */
82 #define CORO_CEDE /* like Coro::cede */
83 #define CORO_CEDE_NOTSELF /* like Coro::cede_notself */
84 #define CORO_READY(coro) /* like $coro->ready */
85 #define CORO_IS_READY(coro) /* like $coro->is_ready */
86 #define CORO_NREADY /* # of procs in ready queue */
87 #define CORO_CURRENT /* returns $Coro::current */
88
89 =cut