Well i can't follow your idea, i guess i think to much in the way i wanted to implement it. Please give me some more informations about your pluggable main Loop.
I though of a static method with a timeout eg "void device::process(int timeout)" which just checks for incomming "events" and if some events occured calls the callback then quits or if none event occured quits after a timeout.
And aother static method for adding devices to the list of processed devices.
device::process will only handle the devices, not the Windows messages or X11 Events, it will be added to the upp main loop by using PostCallback.
It is possible to process all (correct me if i am wrong) "device" events (including files) using poll!
so a typical non-Gui app would have three steps:
1. initialize all devices
2. add devices to the process list
3. call device::process in a loop (then your callbacks set in step 1 will be called)
and a typical Gui ap would be nearly the same, just call another static method eg device::EnableProcessing which would add device::process to the MainLoop of Upp