… | |
… | |
4 | use strict; |
4 | use strict; |
5 | |
5 | |
6 | use Symbol; |
6 | use Symbol; |
7 | use List::Util; |
7 | use List::Util; |
8 | use Socket; |
8 | use Socket; |
9 | use Storable; |
|
|
10 | use Event; |
9 | use Event; |
11 | use Opcode; |
10 | use Opcode; |
12 | use Safe; |
11 | use Safe; |
13 | use Safe::Hole; |
12 | use Safe::Hole; |
|
|
13 | use Storable (); |
14 | |
14 | |
15 | use Coro 4.1 (); |
15 | use Coro 4.1 (); |
16 | use Coro::State; |
16 | use Coro::State; |
17 | use Coro::Handle; |
17 | use Coro::Handle; |
18 | use Coro::Event; |
18 | use Coro::Event; |
… | |
… | |
427 | my $time = Event::time; |
427 | my $time = Event::time; |
428 | |
428 | |
429 | # this is the main coro, too bad, we have to block |
429 | # this is the main coro, too bad, we have to block |
430 | # till the operation succeeds, freezing the server :/ |
430 | # till the operation succeeds, freezing the server :/ |
431 | |
431 | |
432 | LOG llevError | logBacktrace, Carp::longmess "sync job";#d# |
432 | LOG llevError, Carp::longmess "sync job";#d# |
433 | |
433 | |
434 | # TODO: use suspend/resume instead |
434 | # TODO: use suspend/resume instead |
435 | # (but this is cancel-safe) |
435 | # (but this is cancel-safe) |
436 | my $freeze_guard = freeze_mainloop; |
436 | my $freeze_guard = freeze_mainloop; |
437 | |
437 | |
… | |
… | |
971 | # |
971 | # |
972 | |
972 | |
973 | sub _can_merge { |
973 | sub _can_merge { |
974 | my ($ob1, $ob2) = @_; |
974 | my ($ob1, $ob2) = @_; |
975 | |
975 | |
|
|
976 | return 1;#d# |
|
|
977 | |
|
|
978 | #todo#d# kill yourself and do some recursive checking manually without storable |
|
|
979 | sync_job { |
|
|
980 | my $guard = Coro::Storable::guard; |
976 | local $Storable::canonical = 1; |
981 | local $Storable::canonical = 1; |
977 | my $fob1 = Storable::freeze $ob1; |
982 | my $fob1 = Storable::freeze $ob1; |
978 | my $fob2 = Storable::freeze $ob2; |
983 | my $fob2 = Storable::freeze $ob2; |
979 | |
|
|
980 | $fob1 eq $fob2 |
984 | $fob1 eq $fob2 |
|
|
985 | } |
981 | } |
986 | } |
982 | |
987 | |
983 | sub reattach { |
988 | sub reattach { |
984 | # basically do the same as instantiate, without calling instantiate |
989 | # basically do the same as instantiate, without calling instantiate |
985 | my ($obj) = @_; |
990 | my ($obj) = @_; |