Skip to content

Commit

Permalink
Revert defer signal-handling in MCE::Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
marioroy committed Sep 13, 2023
1 parent fdb18b2 commit 8aaa6b9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 50 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Revision history for Perl module MCE.
1.889 Wed Sep 13 15:00:00 EST 2023

* Add Android support. Thank you, Dimitrios Kechagias.
* Revert defer signal-handling in MCE::Channel (send2 method).
* Improve mutex synchronize (aka enter) with guard capability.
Thank you, José Joaquín Atria.
* Fix mutex re-entrant lock on the Windows platform.
Expand Down
12 changes: 2 additions & 10 deletions lib/MCE/Channel/Mutex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,9 @@ sub send2 {
my $data = $freeze->([ @_ ]);

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
local $MCE::Signal::IPC = 1;
( my $c_mutex = $self->{c_mutex} )->lock2;

$self->{c_mutex}->synchronize2( sub {
print { $self->{c_sock} } pack('i', length $data), $data;
$c_mutex->unlock2;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;
});

return 1;
}
Expand Down
12 changes: 2 additions & 10 deletions lib/MCE/Channel/MutexFast.pm
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,9 @@ sub send2 {
my $data = ''.shift;

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
local $MCE::Signal::IPC = 1;
( my $c_mutex = $self->{c_mutex} )->lock2;

$self->{c_mutex}->synchronize2( sub {
print { $self->{c_sock} } pack('i', length $data), $data;
$c_mutex->unlock2;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;
});

return 1;
}
Expand Down
12 changes: 2 additions & 10 deletions lib/MCE/Channel/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,8 @@ sub send2 {
my $data = $freeze->([ @_ ]);

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
local $MCE::Signal::IPC = 1;

MCE::Util::_sock_ready_w( $self->{c_sock} ) if $is_MSWin32;
print { $self->{c_sock} } pack('i', length $data) . $data;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;
MCE::Util::_sock_ready_w( $self->{c_sock} ) if $is_MSWin32;
print { $self->{c_sock} } pack('i', length $data) . $data;

return 1;
}
Expand Down
12 changes: 2 additions & 10 deletions lib/MCE/Channel/SimpleFast.pm
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,8 @@ sub send2 {
my $data = ''.shift;

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
local $MCE::Signal::IPC = 1;

MCE::Util::_sock_ready_w( $self->{c_sock} ) if $is_MSWin32;
print { $self->{c_sock} } pack('i', length $data) . $data;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;
MCE::Util::_sock_ready_w( $self->{c_sock} ) if $is_MSWin32;
print { $self->{c_sock} } pack('i', length $data) . $data;

return 1;
}
Expand Down
5 changes: 0 additions & 5 deletions lib/MCE/Channel/Threads.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,15 @@ sub send2 {
my $data = $freeze->([ @_ ]);

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
my $c_sock = $self->{c2_sock} || $self->{c_sock};

local $MCE::Signal::IPC = 1;
CORE::lock $self->{cw_mutex};

MCE::Util::_sock_ready_w( $c_sock ) if $is_MSWin32;
print { $c_sock } pack('i', length $data), $data;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;

return 1;
}

Expand Down
5 changes: 0 additions & 5 deletions lib/MCE/Channel/ThreadsFast.pm
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,15 @@ sub send2 {
my $data = ''.shift;

local $\ = undef if (defined $\);
local $MCE::Signal::SIG;

{
my $c_sock = $self->{c2_sock} || $self->{c_sock};

local $MCE::Signal::IPC = 1;
CORE::lock $self->{cw_mutex};

MCE::Util::_sock_ready_w( $c_sock ) if $is_MSWin32;
print { $c_sock } pack('i', length $data), $data;
}

CORE::kill($MCE::Signal::SIG, $$) if $MCE::Signal::SIG;

return 1;
}

Expand Down

0 comments on commit 8aaa6b9

Please sign in to comment.