ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Storable.pm
(Generate patch)

Comparing Coro/Coro/Storable.pm (file contents):
Revision 1.8 by root, Mon Oct 8 00:47:19 2007 UTC vs.
Revision 1.9 by root, Fri Oct 12 18:26:13 2007 UTC

76 76
77use Storable; 77use Storable;
78use base "Exporter"; 78use base "Exporter";
79 79
80our $VERSION = '0.2'; 80our $VERSION = '0.2';
81our @EXPORT = qw(thaw freeze nfreeze blocking_freeze blocking_nfreeze); 81our @EXPORT = qw(thaw freeze nfreeze blocking_thaw blocking_freeze blocking_nfreeze);
82 82
83my $lock = new Coro::Semaphore; 83my $lock = new Coro::Semaphore;
84 84
85sub guard { 85sub guard {
86 $lock->guard 86 $lock->guard
108 108
109 open my $fh, ">:via(CoroCede)", \my $buf 109 open my $fh, ">:via(CoroCede)", \my $buf
110 or die "cannot open pst via CoroCede: $!"; 110 or die "cannot open pst via CoroCede: $!";
111 Storable::nstore_fd $_[0], $fh; 111 Storable::nstore_fd $_[0], $fh;
112 $buf 112 $buf
113}
114
115sub blocking_thaw {
116 my $guard = $lock->guard;
117
118 open my $fh, "<", \$_[0]
119 or die "cannot open pst: $!";
120 Storable::fd_retrieve $fh
113} 121}
114 122
115sub blocking_freeze { 123sub blocking_freeze {
116 my $guard = $lock->guard; 124 my $guard = $lock->guard;
117 125

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines