I recommend following like code to reduce lock.

```rb
queue = nil
@log_event_mutex.synchronize{ queue = @log_event_queue; @log_event_queu = [] }
queue.each { |data|
  ...
}
```