ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Kernel.pm
(Generate patch)

Comparing AnyEvent-MP/MP/Kernel.pm (file contents):
Revision 1.111 by root, Sun Mar 25 20:50:49 2012 UTC vs.
Revision 1.112 by root, Tue Oct 2 13:58:07 2012 UTC

124 124
125# initialise names for non-networked operation 125# initialise names for non-networked operation
126{ 126{
127 # ~54 bits, for local port names, lowercase $ID appended 127 # ~54 bits, for local port names, lowercase $ID appended
128 my $now = AE::now; 128 my $now = AE::now;
129 $UNIQ = 129 $UNIQ =
130 (join "", 130 (join "",
131 map $alnum[$_], 131 map $alnum[$_],
132 $$ / 62 % 62, 132 $$ / 62 % 62,
133 $$ % 62, 133 $$ % 62,
134 (int $now ) % 62, 134 (int $now ) % 62,
1045 $cv->end; 1045 $cv->end;
1046 1046
1047 $cv 1047 $cv
1048} 1048}
1049 1049
1050our @POST_CONFIGURE;
1051
1052# not yet documented
1053sub post_configure(&) {
1054 die "AnyEvent::MP::Kernel::post_configure must be called in void context" if defined wantarray;
1055
1056 push @POST_CONFIGURE, @_;
1057 (shift @POST_CONFIGURE)->() while $NODE && @POST_CONFIGURE;
1058}
1059
1050sub configure(@) { 1060sub configure(@) {
1051 unshift @_, "profile" if @_ & 1; 1061 unshift @_, "profile" if @_ & 1;
1052 my (%kv) = @_; 1062 my (%kv) = @_;
1053 1063
1054 my $profile = delete $kv{profile}; 1064 my $profile = delete $kv{profile};
1105 $BINDS{$bind} = $listener; 1115 $BINDS{$bind} = $listener;
1106 push @$BINDS, $bind; 1116 push @$BINDS, $bind;
1107 } 1117 }
1108 } 1118 }
1109 1119
1120 AE::log 9 => "running post config hooks and init.";
1121
1122 # might initialise Global, so need to do it before db_set
1123 post_configure { };
1124
1110 db_set "'l" => $NODE => $BINDS; 1125 db_set "'l" => $NODE => $BINDS;
1111 1126
1112 AE::log 8 => "node listens on [@$BINDS]."; 1127 AE::log 8 => "node listens on [@$BINDS].";
1113 1128
1114 # connect to all seednodes 1129 # connect to all seednodes
1116 master_search; 1131 master_search;
1117 1132
1118 # save gobs of memory 1133 # save gobs of memory
1119 undef &_resolve; 1134 undef &_resolve;
1120 *configure = sub (@){ }; 1135 *configure = sub (@){ };
1136
1137 AE::log 9 => "starting services.";
1121 1138
1122 for (@{ $CONFIG->{services} }) { 1139 for (@{ $CONFIG->{services} }) {
1123 if (ref) { 1140 if (ref) {
1124 my ($func, @args) = @$_; 1141 my ($func, @args) = @$_;
1125 (load_func $func)->(@args); 1142 (load_func $func)->(@args);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines