View Single Post
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#85
Originally Posted by epage View Post
I thought on Linux threads are just a special case of processes and the overhead is very similar? To me the issue would not be on resources but that the sleep() is meant for signaling and doing that in-process would be more efficient than over IPC.
No, no, threads and processes are very different things. A thread is 'just' a separate thread of control in an application (all resources shared), while processes are completely isolated (shared memory notwithstanding). You can start literally thousands of threads in a second as nothing time/memory intensive 'needs to happen' as opposed to processes (which take up memory for their libs and data).

Does anyone know about the level of precision or battery load required in using gobject's timeout_add or timeout_add_seconds? This would save from having to even spawn threads though it would require you to use a gobject main loop.
I have yet to do serious benchmarking, but during my experiments even the brute-force QThread::sleep() approach caused no noticeable battery load.
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc