[Fwd: Re: [Orbit-python-list] Orbit-python and threading?]
Status: Inactive
Brought to you by:
tack
From: Johan D. <jd...@te...> - 2001-11-08 15:36:53
|
doh, i forgot to send a copy to the list tor 2001-11-08 klockan 16.09 skrev Marijn Vriens: > On Thu, Nov 08, 2001 at 09:13:29AM -0200, Christian Robottom Reis wrote: > > On Thu, 8 Nov 2001, Marijn Vriens wrote: > > > There might have been implemented some sort of mainiteration() method in > > ORBit by now (we're at 0.5.12!), but at the time there was none and this > > was a real solution to a complicated problem. > > Yes, i am surprised that there's not.. Orbit has a (degree of) stable > feeling to it, and this is like the second-thing (after pure RPC) that > people would need, I think.. > > > You won't be actually using gtk at all, and there is little effect on your > > program beyond it working. Well, come to think of it, you will need the > > libs, and X11 running and... :-) Well, in my case it was convenient, at > > least. > > Exactly! This is my problem with the GTK solution. I cannot tell now, > if the computers where my program will run on will have all this stuff > installed, I want to avoid dependency bloat if I can. > > Maybe some idea would be to copy/implement the same functionality as > gtk.mainloop(), and let the user decide which of both he/she wants to > use. And when the Orbit people get their stuff together you just > convert this orb.mainloop() (to give the beast some name) to just pure > C calls. > > Again, I have to say that I have no idea how much work is involved > with what I am suggesting :) But that would seem like the "best" > non-dep-bloat solution. > Well if you consider Gtk+ bloat, don't use it. Take a look at oaf, they're using the glib mainloop (same as gtk+ are using). So you don't really need gtk+ for this, but it's easier to require gtk+, so you can use something like the file i just attached. > > > Maybe I am looking at this from the wrong side... What I want Corba > > > for is to provide me with a nice way to give RPC calls for some > > > simulation clients. That Sim server should update it's data according > > > to 2 things: > > > - Events from clients (via Corba). > > > - Time passing. > > > > Why not create a time-ticking client that triggers a call to the server? I > > know it's not magic, but it will work. > > > > > > - Fork() off a process that does the updating and communicates > > > changes via shared-memory or something like that. > > > - Fork() off a process that just calls some "update()" method on a > > > special interface once in a time period, to make the process do the > > > processing for the time that has passed. > > > > Well... I hate both of these. Do you need a forked process, or can you > > spawn one together with the server? > > Ehhh.. of course! Where was my head? I can make the server exec an > extra program ( itself? With some different argv[] ) that does a > update() once in a while.. Not so very horrible. And at least, it > "invisible" for the end-user. Still not the cleanest solution but it > will work. > > Thanks for the Help, It's much appreciated.. > > Marijn. > > -- > Get loaded from the source: Do Linux! > Marijn Vriens <ma...@me...> > GPG/PGP: 6895 DF03 73E1 F671 C61D 45F4 5E83 8571 C529 5C15 ---- # glib.py # # This isn't a a glib wrapper, it's more useful non-ui functions # stolen from gtk import _gtk TRUE = 1 FALSE = 0 def mainloop (): _gtk.gtk_main () def mainquit (*args): _gtk.gtk_main_quit () def mainiteration (block=TRUE): return _gtk.gtk_main_iteration (block) def events_pending (): return _gtk.gtk_events_pending () def idle_add (callback, *args): return _gtk.gtk_idle_add (callback, args) def idle_add_priority (priority, callback): return _gtk.gtk_idle_add_priority (priority, callback) def idle_remove (tag): _gtk.gtk_idle_remove (tag) def quit_add (mainlevel, callback, *args): return _gtk.gtk_quit_add (mainlevel, callback, args) def quit_add_destroy (mainlevel, object): _gtk.gtk_quit_add_destroy (mainlevel, object._o) def quit_remove (tag): _gtk.gtk_quit_remove (tag) def timeout_add (timeout, callback, *args): return _gtk.gtk_timeout_add (timeout, callback, args) def timeout_remove (tag): _gtk.gtk_timeout_remove (tag) def input_add (source, condition, callback): if hasattr (source, 'fileno'): # handle python file handles def wrapper (source, condition, real_s=source,real_cb=callback): real_cb (real_s, condition) return _gtk.gtk_input_add (source.fileno (), condition, wrapper) else: return _gtk.gtk_input_add (source, condition, callback) def input_remove (tag): _gtk.gtk_input_remove (tag) |