[openbeos] Launching the input_server from the app_server...

  • From: "Ryan Leavengood" <leavengood@xxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 21 Dec 2006 21:01:31 -0800 (PST)

I'm trying to implement this feature and I have a few questions. Axel 
outlined most of what needs to be done in this message:

http://lists.berlios.de/pipermail/haiku-commits/2006-November/009502.html

But there are still a few things I'm wondering:

1. What is the best way for the EventDispatcher to notify the desktop 
that it has stop processing events and therefore the input_server has 
stopped running? What I have done so far is to have a Desktop* member 
in the EventDispatcher which is set in Desktop::Init() 
(fEventDispatcher.SetDesktop(this)), and then when the event processing 
loop ends in EventDispatcher, fDeskop->
PostMessage(AS_LAUNCH_INPUT_SERVER) is called. I don't know if I like 
this since it introduces a sort of circular dependency (though in a 
sense this already exists since the EventDispatcher owns a 
KeyboardFilter and MouseFilter which also own Desktop pointers.) Any 
other suggestions?

2. How should the input_server be launched in 
Desktop::_LaunchInputServer? I was thinking of copying some of the code 
from the older commented-out _LaunchInputServer in AppServer.cpp that 
calls load_image, etc. But I was thinking that now that the Registrar 
is started before the app_server, maybe somehow the Registrar could be 
used? Again, any suggestions would be appreciated.

3. One small little detail. Axel talks a little about this in the above 
message, but I'm still wondering that if the EventDispatcher is 
supposed to _Unset itself when the event loop ends, this could cause 
some sort of deadlock since _Unset calls wait_for_thread on fThread, 
which would be the thread calling _Unset from the loop. I guess my main 
question is what happens if wait_for_thread is called with the 
thread_id of the current thread? Axel sort of hinted that maybe fThread 
should be set to some error value before _Unset is called. In my 
current code I do this by setting fThread to -1 before calling _Unset, 
but I'm wondering if this is unneeded. So far I haven't tested this 
since I haven't done 2 above yet.

Thanks,
Ryan

Other related posts: