From win32utils-devel at rubyforge.org Mon Jan 3 09:17:04 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Mon Jan 3 09:15:04 2005 Subject: [Win32utils-devel] win32-thread experiment Message-ID: <8FE83020B9E1A248A182A9B0A7B76E7358B13C@itomae2km07.AD.QINTRA.COM> > Hi Dan, Hi, I'm back from vacation. :) > On Fri, 17 Dec 2004 00:22:19 +0900, Daniel Berger wrote: > > I've tried tinkering with rb_gc_disable() and rb_gc_start() > in various > > places in the code but I haven't had any luck. I'm still getting > > segfaults. > On the threading, what if you call rb_gc_disable(), then > create some win32 threads and see if you still get segfaults? > (Don't ever call rb_gc_start). I played around with this without luck. Did you have any? > Of course, if the threads are doing much with Ruby objects > they'll be creating garbage, so at some point the process > will run out of memory due to the lack of GC. This is just > an experiment to see if threads can run happily if GC is off. > If so, we can try to figure out where to go from here. > > Wayne If you have any suggestions, I'm all ears. Also note that I've got a highly experimental version of win32-fiber checked into CVS. :) Regards, Dan From win32utils-devel at rubyforge.org Tue Jan 4 02:03:34 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Tue Jan 4 02:01:32 2005 Subject: [Win32utils-devel] win32-thread experiment In-Reply-To: <8FE83020B9E1A248A182A9B0A7B76E7358B13C@itomae2km07.AD.QINTRA.COM> References: <8FE83020B9E1A248A182A9B0A7B76E7358B13C@itomae2km07.AD.QINTRA.COM> Message-ID: Hi Dan, > I played around with this without luck. Did you have any? I haven't had time to give it a try myself. Unfortunately, from your results it sounds like more than just the GC is causing problems. Actually, that's doubly unfortunate, as the GC is one of the few aspects of the environment that we can turn on and off when we want to. Take care, Wayne On Mon, 3 Jan 2005 08:17:04 -0600, win32utils-devel@rubyforge.org wrote: > > Hi Dan, > > Hi, I'm back from vacation. :) > > > On Fri, 17 Dec 2004 00:22:19 +0900, Daniel Berger wrote: > > > I've tried tinkering with rb_gc_disable() and rb_gc_start() > > in various > > > places in the code but I haven't had any luck. I'm still getting > > > segfaults. > > > > > On the threading, what if you call rb_gc_disable(), then > > create some win32 threads and see if you still get segfaults? > > (Don't ever call rb_gc_start). > > I played around with this without luck. Did you have any? > > > Of course, if the threads are doing much with Ruby objects > > they'll be creating garbage, so at some point the process > > will run out of memory due to the lack of GC. This is just > > an experiment to see if threads can run happily if GC is off. > > If so, we can try to figure out where to go from here. > > > > Wayne > > If you have any suggestions, I'm all ears. Also note that I've got a > highly experimental version of win32-fiber checked into CVS. :) > > Regards, > > Dan > > _______________________________________________ > win32utils-devel mailing list > win32utils-devel@rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > From win32utils-devel at rubyforge.org Tue Jan 4 18:27:04 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Tue Jan 4 18:27:57 2005 Subject: [Win32utils-devel] Ruby 1.8.2 and win32-open3 Message-ID: FYI It looks like the test suite for win32-open3 segfaults with the latest Windows installer. Ugh. I'll take a look at that this week. So much for getting 0.2.0 out the door tonight. - Dan From win32utils-devel at rubyforge.org Wed Jan 5 10:41:48 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Wed Jan 5 10:39:45 2005 Subject: [Win32utils-devel] Ruby 1.8.2 and win32-open3 Message-ID: <8FE83020B9E1A248A182A9B0A7B76E7358B14A@itomae2km07.AD.QINTRA.COM> > -----Original Message----- > From: win32utils-devel-bounces@rubyforge.org > [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of > win32utils-devel@rubyforge.org > Sent: Tuesday, January 04, 2005 4:27 PM > To: win32utils-devel@rubyforge.org > Subject: [Win32utils-devel] Ruby 1.8.2 and win32-open3 > > > FYI > > It looks like the test suite for win32-open3 segfaults with > the latest > Windows installer. Ugh. Upon further review, this appears to be a VC++ 6 vs 7 issue. I had no problems on my WinXP Pro box using VC++ 7. I'll make a note in the "Known Bugs" section of the docs. Dan From win32utils-devel at rubyforge.org Thu Jan 6 12:00:57 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Thu Jan 6 11:58:57 2005 Subject: [Win32utils-devel] Some thoughts on win32-changenotify Message-ID: <8FE83020B9E1A248A182A9B0A7B76E7358B153@itomae2km07.AD.QINTRA.COM> Hi all, As things stand now, you can do something like this with win32-changenotify: require "win32/changenotify" include Win32 filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME | ChangeNotify::LAST_WRITE cn = ChangeNotify.new("c:\\",false,filter){ puts "Something changed" } cn.wait You can pass a block that's executed when a change occurs, but you can't get any details about the change. I would like to alter that behavior so that a ChangeNotifyStruct is yielded to the block that contains two bits of information - the file or directory that was changed and what that change would be. So, that example would look something like this: filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME | ChangeNotify::LAST_WRITE cn = ChangeNotify.new("c:\\",false,filter){ |cns| puts "File changed: " + cns.file_name puts "Action: " + cns.action } cn.wait That means altering changenotify.c to use ReadDirectoryChangesW() instead of FindFirstChangeNotification(). Our Ruby ChangeNotifyStruct would contain two members, "action" and "file_name" that would be the Action and FileName members of the FILE_NOTIFY_INFORMATION structure. I've tinkered around with this but I'm having a couple issues. I can open a directory and call ReadDirectoryChangesW() successfully, but I can't figure out how to read back out of the buffer (nor am I exactly sure what to pass as a buffer in the first place). Here's the basic approach. // Get a handle to the directory. hDir = CreateFile( lpPathName, FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); if(hDir == INVALID_HANDLE_VALUE) { rb_raise(cChangeNotifyError,ErrorDescription(GetLastError())); } if(!ReadDirectoryChangesW( hDir, Buf, sizeof(Buf), bWatchSubtree, dwNotifyFilter, &dwBytesReturned, NULL, NULL )){ rb_raise(cChangeNotifyError,ErrorDescription(GetLastError())); } So, the question is, what exactly should "Buf" be and how do I read a single record back out of it? Any takers? Regards, Dan From win32utils-devel at rubyforge.org Thu Jan 20 16:44:41 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Thu Jan 20 16:42:06 2005 Subject: [Win32utils-devel] ChangeNotify help wanted Message-ID: <8FE83020B9E1A248A182A9B0A7B76E7358B1B5@itomae2km07.AD.QINTRA.COM> Hi all, I've checked in some code to win32-changenotify. Unfortunately, it doesn't work right. I need some help. I don't understand what, exactly, I'm supposed to pass to ReadDirectoryChangesW() for the 2nd argument, nor how to read the data back out. There's also a WCHAR issue that needs to be worked out with regards to the FileName FILE_NOTIFY_INFORMATION struct member. Please see the changenotify_init() function in changenotify.c. HELP! Regards, Dan From win32utils-devel at rubyforge.org Fri Jan 21 21:04:51 2005 From: win32utils-devel at rubyforge.org (win32utils-devel@rubyforge.org) Date: Fri Jan 21 21:02:15 2005 Subject: [Win32utils-devel] ChangeNotify help wanted References: <8FE83020B9E1A248A182A9B0A7B76E7358B1B5@itomae2km07.AD.QINTRA.COM> Message-ID: <000601c50026$c271ead0$fb0d5bd2@2xnm9896kmqn5b9> Hi Dan, > Hi all, > > I've checked in some code to win32-changenotify. Unfortunately, it > doesn't work right. I need some help. I don't understand what, > exactly, I'm supposed to pass to ReadDirectoryChangesW() for the 2nd > argument, nor how to read the data back out. > > There's also a WCHAR issue that needs to be worked out with regards to > the FileName FILE_NOTIFY_INFORMATION struct member. > > Please see the changenotify_init() function in changenotify.c. > > HELP! > > Regards, > > Dan You should have read carefully the document http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/readdirectorychangesw.asp :-) Upon successful synchronous completion, the lpBuffer parameter is a formatted buffer and the number of bytes written to the buffer is available in lpBytesReturned. If the number of bytes transferred is zero (0), the buffer was too small to provide detailed information on all the changes that occurred in the directory or subtree. In this case, you should compute the changes by enumerating the directory or subtree. It seems that ReadDirectoryChangesW needs sufficient buffer for synchronous mode. Here is my test code: changenotify_init(VALUE self, VALUE rbPath, VALUE rbSubtree, VALUE rbFilter) { HANDLE hDir; VALUE rbObject, rbStruct, rbAction; FILE_NOTIFY_INFORMATION fni[1024]; LPCTSTR lpPathName = RSTRING(rbPath)->ptr; BOOL bWatchSubtree = (rbSubtree == Qtrue) ? TRUE : FALSE; DWORD dwNotifyFilter = NUM2INT(rbFilter); DWORD dwBytesReturned = 0; ChangeNotifyStruct* ptr; int i = 0; char filename[256]; Data_Get_Struct(self,ChangeNotifyStruct,ptr); // Get a handle to the directory. hDir = CreateFile( lpPathName, FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); if(hDir == INVALID_HANDLE_VALUE) { rb_raise(cChangeNotifyError,ErrorDescription(GetLastError())); } memset(&fni[0],0x00,sizeof(fni[0])*1024); if(ReadDirectoryChangesW( hDir, &fni[0], sizeof(fni[0])*1024, bWatchSubtree, dwNotifyFilter, &dwBytesReturned, NULL, NULL )==0){ rb_raise(cChangeNotifyError,ErrorDescription(GetLastError())); } WideCharToMultiByte(CP_ACP,0,fni[0].FileName,-1,filename,256,NULL,NULL); printf("changenotify action=%ld,return=%ld,filenamd=%s \n",fni[0].Action,dwBytesReturned,filename); ..... } Regards, Park Heesob From djberg96 at hotmail.com Mon Jan 24 17:29:23 2005 From: djberg96 at hotmail.com (Daniel Berger) Date: Mon Jan 24 17:27:17 2005 Subject: [Win32utils-devel] Test email Message-ID: This is a test to see if the "from" line shows up as me instead the generic list. I had to tweak a setting I didn't know about (dammit). Dan In the immortal words of Socrates, "I drank what?" From djberg96 at hotmail.com Tue Jan 25 21:44:00 2005 From: djberg96 at hotmail.com (Daniel Berger) Date: Tue Jan 25 21:42:16 2005 Subject: [Win32utils-devel] Change Journals Message-ID: Hi, I've released win32-changenotify 0.3.0 today. Take a look. Park and I have discussed a Ruby interface to change journals a little bit: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/creating_modifying_and_deleting_a_change_journal.asp Park, would you like to do this, or did you want me to? I wasn't sure from your RubyForge post. Also, do folks think this should be bundled with win32-changenotify (as a separate class) or should it be a different package altogether? Regards, Dan In the immortal words of Socrates, "I drank what?" From phasis at nownuri.net Wed Jan 26 08:17:25 2005 From: phasis at nownuri.net (Park Heesob) Date: Wed Jan 26 08:14:39 2005 Subject: [Win32utils-devel] Change Journals References: Message-ID: <00c701c503a9$60b52dd0$e80d5bd2@2xnm9896kmqn5b9> Hi, > Hi, > > I've released win32-changenotify 0.3.0 today. Take a look. > > Park and I have discussed a Ruby interface to change journals a little bit: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/creating_modifying_and_deleting_a_change_journal.asp > > Park, would you like to do this, or did you want me to? I wasn't sure from > your RubyForge post. > I'd like to do that by this weekend. > Also, do folks think this should be bundled with win32-changenotify (as a > separate class) or should it be a different package altogether? > How about different package name of win32-changejournal? Regards, Park Heesob From sdate at everestkc.net Wed Jan 26 09:30:34 2005 From: sdate at everestkc.net (Shashank Date) Date: Wed Jan 26 09:27:51 2005 Subject: [Win32utils-devel] Change Journals In-Reply-To: <00c701c503a9$60b52dd0$e80d5bd2@2xnm9896kmqn5b9> References: <00c701c503a9$60b52dd0$e80d5bd2@2xnm9896kmqn5b9> Message-ID: <41F7A98A.8010709@everestkc.net> Park Heesob wrote: >>Also, do folks think this should be bundled with win32-changenotify (as a >>separate class) or should it be a different package altogether? >> >> >> >How about different package name of win32-changejournal? > > +1 -- shanko From Daniel.Berger at qwest.com Wed Jan 26 09:55:46 2005 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Wed Jan 26 09:52:59 2005 Subject: [Win32utils-devel] Change Journals Message-ID: <8FE83020B9E1A248A182A9B0A7B76E7358B1BE@itomae2km07.AD.QINTRA.COM> > -----Original Message----- > From: win32utils-devel-bounces@rubyforge.org > [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of > Shashank Date > Sent: Wednesday, January 26, 2005 7:31 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Change Journals > > > Park Heesob wrote: > > >>Also, do folks think this should be bundled with win32-changenotify > >>(as a > >>separate class) or should it be a different package altogether? > >> > >> > >> > >How about different package name of win32-changejournal? > > > > > > +1 > > -- shanko Ok, win32-changejournal it is. :) Dan