Hi Axel,
-void -AppServer::RunLooper() +Desktop * +AppServer::_CreateDesktop(uid_t userID) { - rename_thread(find_thread(NULL), "picasso"); - _message_thread((void *)this); + BAutolock locker(fDesktopLock); + Desktop* desktop = NULL; + try { + desktop = new Desktop(userID); + + desktop->Init(); + desktop->Run(); + + if (!fDesktops.AddItem(desktop)) { + delete desktop; + return NULL; + } + } catch (...) { + // there is obviously no memory left + return NULL; + } + + return desktop;
...+ while (fDesktops.CountItems() > 0) { + Desktop *desktop = fDesktops.RemoveItemAt(0);
...+ } - Layer *layer; - for (int32 i = 0; i < windowCount; ++i) - // is this layer in fact a WinBorder? - if ((layer = static_cast<Layer*>(sDesktop->WindowList().ItemAtFast(i)))) {
- }
To avoid a few CPU cycles please pull out local declarations from loops.
+ // is this layer in fact a WinBorder? + WinBorder *winBorder = WindowList().ItemAt(i);
Bye, Adi.