[前][次][番号順一覧][スレッド一覧]

ruby-changes:40606

From: sonots <ko1@a...>
Date: Fri, 20 Nov 2015 23:17:15 +0900 (JST)
Subject: [ruby-changes:40606] sonots:r52685 (trunk): * lib/logger.rb: expose logger mutex

sonots	2015-11-20 23:16:56 +0900 (Fri, 20 Nov 2015)

  New Revision: 52685

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52685

  Log:
    * lib/logger.rb: expose logger mutex
    [fix GH-541] Patch by @arthurnn

  Modified files:
    trunk/ChangeLog
    trunk/lib/logger.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52684)
+++ ChangeLog	(revision 52685)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov 20 23:15:18 2015  Naotoshi Seo  <sonots@g...>
+
+	* lib/logger.rb: expose logger mutex
+	  [fix GH-541] Patch by @arthurnn
+
 Fri Nov 20 15:05:28 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* Added missing reference of GitHub
Index: lib/logger.rb
===================================================================
--- lib/logger.rb	(revision 52684)
+++ lib/logger.rb	(revision 52685)
@@ -626,14 +626,11 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L626
 
     attr_reader :dev
     attr_reader :filename
-
-    class LogDeviceMutex
-      include MonitorMixin
-    end
+    include MonitorMixin
 
     def initialize(log = nil, opt = {})
       @dev = @filename = @shift_age = @shift_size = nil
-      @mutex = LogDeviceMutex.new
+      mon_initialize
       set_dev(log)
       if @filename
         @shift_age = opt[:shift_age] || 7
@@ -644,7 +641,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L641
 
     def write(message)
       begin
-        @mutex.synchronize do
+        synchronize do
           if @shift_age and @dev.respond_to?(:stat)
             begin
               check_shift_log
@@ -665,7 +662,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L662
 
     def close
       begin
-        @mutex.synchronize do
+        synchronize do
           @dev.close rescue nil
         end
       rescue Exception
@@ -677,7 +674,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L674
       # reopen the same filename if no argument, do nothing for IO
       log ||= @filename if @filename
       if log
-        @mutex.synchronize do
+        synchronize do
           if @filename and @dev
             @dev.close rescue nil # close only file opened by Logger
             @filename = nil

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]