--- deliantra/server/lib/cf.pm 2007/01/05 10:23:05 1.137 +++ deliantra/server/lib/cf.pm 2007/01/05 17:07:17 1.138 @@ -223,22 +223,6 @@ } } -=item cf::async { BLOCK } - -Like C, but runs the given BLOCK in an eval and only logs the -error instead of exiting the server in case of a problem. - -=cut - -sub async(&) { - my ($cb) = @_; - - Coro::async { - eval { $cb->() }; - warn $@ if $@; - } -} - sub freeze_mainloop { return unless $TICK_WATCHER->is_active; @@ -274,7 +258,7 @@ my $busy = 1; my @res; - (Coro::async { + (Coro::async_pool { @res = eval { $job->() }; warn $@ if $@; undef $busy; @@ -295,15 +279,15 @@ =item $coro = cf::coro { BLOCK } -Creates and returns a new coro. This coro is automcatially being canceled -when the extension calling this is being unloaded. +Creates (and readies) and returns a new coro. This coro is automcatially +being canceled when the extension calling this is being unloaded. =cut sub coro(&) { my $cb = shift; - my $coro = &cf::async ($cb); + my $coro = &Coro::async_pool ($cb); $coro->on_destroy (sub { delete $EXT_CORO{$coro+0}; @@ -1557,7 +1541,7 @@ # should happen only on crashes if ($pl->ob->{_link_pos}) { $pl->ob->enter_link; - cf::async { + Coro::async_pool { # we need this sleep as the login has a concurrent enter_exit running # and this sleep increases chances of the player not ending up in scorn Coro::Timer::sleep 1; @@ -1576,7 +1560,7 @@ $self->enter_link; - (cf::async { + (Coro::async_pool { $path = new cf::path $path; my $map = cf::map::find $path->as_string; @@ -1648,7 +1632,7 @@ $self->enter_link; - (cf::async { + (Coro::async_pool { $self->deactivate_recursive; # just to be sure unless (eval { prepare_random_map $exit @@ -1750,7 +1734,7 @@ sub cf::client::coro { my ($self, $cb) = @_; - my $coro = &cf::async ($cb); + my $coro = &Coro::async_pool ($cb); $coro->on_destroy (sub { delete $self->{_coro}{$coro+0};