[Win32utils-devel] seg on windows-pr-0.5.1 (was RE: [ANN] win32-eventlog 0.4.0)

Heesob Park phasis at gmail.com
Mon May 29 23:59:39 EDT 2006


Hi,

2006/5/30, Daniel Berger <djberg96 at gmail.com>:
> Peña wrote:
> > Hi Dan,
> > i get a segfault on windows-pr if i run mulitple tails by threading, one thread for each host i'm tailing.
> >
> > C:\family\ruby\win-eventlog>dtail.rb
> > thread/tail-ing Security on host1
> > thread/tail-ing Security on host2
> > thread/tail-ing Security on host3
> > thread/tail-ing Security on host4
> > thread/tail-ing Security on host5
> > thread/tail-ing Security on host6
> > c:/ruby/lib/ruby/gems/1.8/gems/windows-pr-0.5.1-mswin32/lib/windows/error.rb:295: [BUG] Segmentation fault
> > ruby 1.8.4 (2005-12-24) [i386-mswin32]
> > C:\family\ruby\win-eventlog>
> >
> > my code looks like,
> >
> > #---
> >    threads = []
> >    while x = DATA.gets do
> >       eventlog,host = x.split
> >       printf "thread/tail-ing %s on %s\n",eventlog,host
> >       threads << Thread.new(eventlog,host) do |log,host|
> >             tail_log log,host
> >          end
> >       #tail_log  eventlog, host
> >    end
> >    threads.each {|t| t.join}
> > #---
> >
> > is tail thread-safe or do i need to run it separately for each host for the mean time?
>
> Wow, I never imagined folks running a series of eventlogs in different
> threads.
>
> Anyone have any ideas on this?
>
> Dan
>
I guess the code needs something like this for thread-safe:

   require 'thread'
   semaphore = Mutex.new

   semaphore.synchronize {
       get_last_error
    }


Regards,

Park Heesob



More information about the win32utils-devel mailing list