diff options
author | Eric Wong <e@80x24.org> | 2017-03-16 03:14:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-18 01:28:47 +0000 |
commit | a7db691c628dc91084e15e0bd105420e93a9f1b4 (patch) | |
tree | 0540e60adf2c9928302d4790b9e926b364162e5c /lib/raindrops | |
parent | 8d9f163a159a1366a86ba166142b4f6f3fd38083 (diff) | |
download | raindrops-a7db691c628dc91084e15e0bd105420e93a9f1b4.tar.gz |
And rely on frozen string optimizations in Ruby while we're at it.
Diffstat (limited to 'lib/raindrops')
-rw-r--r-- | lib/raindrops/aggregate/pmq.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/raindrops/aggregate/pmq.rb b/lib/raindrops/aggregate/pmq.rb index a2dd45e..f543302 100644 --- a/lib/raindrops/aggregate/pmq.rb +++ b/lib/raindrops/aggregate/pmq.rb @@ -39,9 +39,9 @@ class Raindrops::Aggregate::PMQ # :stopdoc: # These constants are for Linux. This is designed for aggregating # TCP_INFO. - RDLOCK = [ Fcntl::F_RDLCK ].pack("s @256") - WRLOCK = [ Fcntl::F_WRLCK ].pack("s @256") - UNLOCK = [ Fcntl::F_UNLCK ].pack("s @256") + RDLOCK = [ Fcntl::F_RDLCK ].pack("s @256".freeze).freeze + WRLOCK = [ Fcntl::F_WRLCK ].pack("s @256".freeze).freeze + UNLOCK = [ Fcntl::F_UNLCK ].pack("s @256".freeze).freeze # :startdoc: # returns the number of dropped messages sent to a POSIX message @@ -185,10 +185,12 @@ class Raindrops::Aggregate::PMQ def synchronize io, type # :nodoc: @mutex.synchronize do begin + type = type.dup lock! io, type yield io ensure - lock! io, UNLOCK + lock! io, type.replace(UNLOCK) + type.clear end end end |