Hi, First, thx for your reply.
2009/7/10 Scott Thompson <ea...@mac.com> > > On Jul 10, 2009, at 3:40 PM, Julien Isorce wrote: > > In GNUstep it's possible to decide which pthread is the "main thread". >> I mean the first pthread which call GSRegisterCurrentThread, is the main >> thread. >> >> And then the NSApp must be init and run in this main thread, as it's >> required on MacOSX. >> >> Is it possible to change the "main thread" as far as Cocoa is concerned, >> on >> MacOSX ? (something like GSRegisterCurrentThread) >> > > What is the point of such a routine? > > Suppose that the application starts and we give the main thread the label > "Thread A". You spin up an new thread that we will give the label "Thread > B. You then use your routine to make the thread with the label "Thread B" > to be the main thread. Now the main thread has a "Thread B" sign and there > is another thread with a "Thread A" sign hanging off of it. > > How is this different than if you had simply started the application gave > the the main thread the label "Thread B", then started a new thread and gave > it the label "Thread A"? > sure but in the previous mails I tried to explain that I am making a plugin (which consists of a dynamic library) of a program which I have not the source code. So in your example, the difference is that I can run the NSApp in the main thread (Thread B). And it's usefull because I have no access to the thread A. With GNUstep Cocoa, in the plugin I create a pthread (thread B) and then I am registering it to be the main thread. Then I am running NSApp in there. > > > In this way no performInMainThreads are borken, and it's a solution to my >> problem. >> > > It's still not clear what your problem is. > > What exactly is it that are you trying to do on Mac OS X? What is the > environment in which your code is running and what effect are you trying to > achieve? > > The only guess I can make is that you are trying to create a plugin for > something like the GIMP and you want to use Cocoa from that plugin. yup something like that. > > > There may be a way to solve your problem properly in Mac OS X, I experimented on MacOSX and it seems that a pthread (I mean a thread created using native C api) is automatically converted to a NSThread so it's cool. (whereas on GNUstep I have to call GSRegisterCurrentThread) So the final question: is there a way to make [NSThread isMainThread] return YES in a thread different that the main thread of a process, on MacOSX ? > but we need to know what the problem is (not how you think you want to > solve the problem). Maybe you did not get my first email where I explained everything (dated: 8 juillet 2009 10:34 am, Paris. I can re send it if this is the case) > > > Scott > > Sincerely Julien _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com