ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.614 by root, Mon Nov 26 15:12:16 2012 UTC vs.
Revision 1.616 by root, Mon Aug 10 03:05:30 2015 UTC

687 687
688 while ($busy) { 688 while ($busy) {
689 if (Coro::nready) { 689 if (Coro::nready) {
690 Coro::cede_notself; 690 Coro::cede_notself;
691 } else { 691 } else {
692 EV::loop EV::LOOP_ONESHOT; 692 EV::run EV::RUN_ONESHOT;
693 } 693 }
694 } 694 }
695 695
696 my $time = AE::time - $time; 696 my $time = AE::time - $time;
697 697
2787The player should be reasonably safe there for short amounts of time (e.g. 2787The player should be reasonably safe there for short amounts of time (e.g.
2788for loading a map). You I<MUST> call C<leave_link> as soon as possible, 2788for loading a map). You I<MUST> call C<leave_link> as soon as possible,
2789though, as the player cannot control the character while it is on the link 2789though, as the player cannot control the character while it is on the link
2790map. 2790map.
2791 2791
2792Will never block. 2792This method will never block, which is the whole reaosn for it's
2793existance: you can I<always> put a player onto the link map, which is the
2794only place to put objects that is guaranteed to exist.
2795
2796A typical usage pattern is to call C<enter_link> synchronously from the
2797server, then start a new thread, do your blocking stuff there and then
2798call C<leave_link> from that thread.
2793 2799
2794=item $player_object->leave_link ($map, $x, $y) 2800=item $player_object->leave_link ($map, $x, $y)
2795 2801
2796Moves the player out of the special C<{link}> map onto the specified 2802Moves the player out of the special C<{link}> map onto the specified
2797map. If the map is not valid (or omitted), the player will be moved back 2803map. If the map is not valid (or omitted), the player will be moved back
3909 seek $fh, 0, 0; 3915 seek $fh, 0, 0;
3910 print $fh $$; 3916 print $fh $$;
3911} 3917}
3912 3918
3913sub main_loop { 3919sub main_loop {
3914 trace "EV::loop starting\n"; 3920 trace "EV::run starting\n";
3915 if (1) { 3921 if (1) {
3916 EV::loop; 3922 EV::run;
3917 } 3923 }
3918 trace "EV::loop returned\n"; 3924 trace "EV::run returned\n";
3919 goto &main_loop unless $REALLY_UNLOOP; 3925 goto &main_loop unless $REALLY_UNLOOP;
3920} 3926}
3921 3927
3922sub main { 3928sub main {
3923 cf::init_globals; # initialise logging 3929 cf::init_globals; # initialise logging
3932 # we must not ever block the main coroutine 3938 # we must not ever block the main coroutine
3933 $Coro::idle = sub { 3939 $Coro::idle = sub {
3934 Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# 3940 Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d#
3935 (async { 3941 (async {
3936 $Coro::current->{desc} = "IDLE BUG HANDLER"; 3942 $Coro::current->{desc} = "IDLE BUG HANDLER";
3937 EV::loop EV::LOOP_ONESHOT; 3943 EV::run EV::RUN_ONESHOT;
3938 })->prio (Coro::PRIO_MAX); 3944 })->prio (Coro::PRIO_MAX);
3939 }; 3945 };
3940 3946
3941 evthread_start IO::AIO::poll_fileno; 3947 evthread_start IO::AIO::poll_fileno;
3942 3948

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines