Not sure, if I understand what you are trying to say. I don't see any explicit permissions being used by our code and don't know why they would be needed on an handle we create ourselves.
The first thing I notice when looking at this code is that we don't check event before calling SetEvent. In all other places we do. Then there is a problem with the call to CreateEvent for this event: if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE) When the call to CreateEvent fails it will not return INVALID_HANDLE_VALUE, but NULL. Most likely we will need to change all the checks in this file to use that value. If this is true, it still leaves the question why the initial call to CreateEvent could fail and I have no answer to that. Perhaps the error message will tell us. Could you please try this change and report back, whether it works better than the current code? Fred Samantha Rahn wrote: > From: Samantha Rahn <[email protected]> > Date: Mon, Apr 6, 2009 at 6:51 PM > Subject: Re: Messaging across threads using NSThread > To: Nicolas Roard <[email protected]> > > I am running Gnustep under Windows and am finding that that method > performSelectorOnMainThread: as well as other related methods and > other NSPort related methods do not work. Specifically with this > performSelectorMethod I find that the windows call below fails with > error: > > 2009-04-03 19:21:58.527 Tool[1234] Set event failed - The handle is invalid. > > The applicable code in NSThread.m is: > > - (void) addPerformer: (id)performer > { > [lock lock]; > [performers addObject: performer]; > #if defined(__MINGW32__) > if (SetEvent(event) == 0) > { > NSLog(@"Set event failed - %@", [NSError _last]); > } > #else > if (write(outputFd, "0", 1) != 1) > { > NSLog(@"Write to pipe failed - %@", [NSError _last]); > } > #endif > [lock unlock]; > } > > > After reading about the SetEvent function call on MSDN, I learned that > there is a security model for Windows to send messages using SetEvent. > However, the code sends a NULL value for the permissions (uses the > default security). > > Does anyone know what configuration is required to allow this to work > under Windows? > > Thanks so much for any assistance. > Sam > > > On Mon, Apr 6, 2009 at 6:06 PM, Nicolas Roard <[email protected]> wrote: >> On Mon, Apr 6, 2009 at 11:09 PM, Fred Kiefer <[email protected]> wrote: >>> Nicolas Roard wrote: >>>> On Mon, Apr 6, 2009 at 8:48 PM, Riccardo Mottola <[email protected]> wrote: >>>>> Hello, >>>>> >>>>> in FTP (available in GAP, http://gap.nongnu.org) I do inter-thread >>>>> messaging >>>>> with the precise goal to have threads perform operations on the main >>>>> thread >>>>> GUI operations. >>>>> >>>>> I set up DO between the app itself this way: >>>> I was surprised that you did not mention performSelectorOnMainThread: >>>> (http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/performSelectorOnMainThread:withObject:waitUntilDone:) >>>> but it sadly doesn't seem to be implemented on gnustep (I was sure it >>>> was !?). >>>> >>> >>> It is there in NSThread.m, most likly you looked in a different place. >> Ah, thanks ! yes, I only looked in NSObject.m. My bad ! >> _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep
