Re: [Gtk-osx-users] Notes on handling Apple events with gtk_osxapplication and PyGTK




On 27/08/2010, at 4:14 AM, John Ralls wrote:
That doesn't sound like a race condition (which usually means that two threads are writing to a shared resource that lacks mutex or semaphore protection).

I guess it comes down to semantics - I use it in the more general sense of an error due to (possibly random) differences in the relative speed of at least two processes: in this case OS X and the application. Semaphores are a means to ensure correctness without having to account for their relative speed (and which, incidentally, may therefore miss 'optimisation' opportunities as a result: a false economy but something held against them early on, as mentioned by Dijkstra in answer to a question at the end of this talk: http:// userweb.cs.utexas.edu/users/EWD/videos/EWD2.mpg).

Rather, it sounds like the notification handler isn't turned on until NSApplication::FinshedLaunching is called, and that OSX doesn't queue the notification until then. I'll have to dig into that a bit, but ISTM the event loop is going to be required for properly handling the notification.

Yes. Since writing, I've dug into it a little further and decided the most convenient thing from the point of view of the user is for the signal to be emitted only after ready() has been called as otherwise all sorts of hoop jumping is required. The docs suggest there is a way to holdoff the OS X notification on startup, if I'm reading them right, which I'm looking into more deeply at the moment.

I don't understand what you mean by "multiple instances of the process". That's not possible. Do you mean that if you have multiple copies of the program running, only the first-launched gets the notification? That's the way OSX works. It expects there to be only one running instance of a program, which may have open multiple documents.

Probably sloppy terminology on my part. What I meant is running multiple instances of the same application bundle, which is possible from OS X 10.5 onwards by passing the '-n' argument to open(1).

Just to be clear, I wasn't suggesting any of this was necessarily a bug in gtk_osxapplication - only to let others know of what I had found in using it.

regards,
Richard.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]