I'm writing a live wallpaper, and I'm closing two separate threads in my main wallpaper service. An update, and other draws. I was under the impression that once you call thread.start (), it takes care of everything for you, but after some trial and error, it seems that if I want my update and walk Pulls threads, so will I have to manually keep their run (called) methods? In other words, instead of calling and forgetting callings () on both threads, I have to manually set a delayed handler event, which calls thread.run () on both updates and pulls every 16 milliseconds thread is. Is this the right way to be a long running thread?
Besides, to kill the thread, I'm just setting them to Diman, then I'm excluding them. Is this method OK? In most instances, I see the use of intermediate () / loop in the loop ... I do not understand ...
- no
- no
After leaving the run () method, the thread is considered to be terminated. If you want to run the thread "forever", then you need to repeat your tasks. For # 2, threads will continue to run, even if you lose all its references. I suggest a signal or position to the worker thread, after joining the main thread.
Comments
Post a Comment