BlackBerry queue thread

I've seen BB API (5.0), and I can't find any method to execute a batch of threads serially I know BB has a limit on the number of threads it will start, so if the user clicks fast enough, but I can't find anything similar to thread pool, I don't want to start 7

Is there a simple solution or do I have to create data structures?

Solution

If you just want to execute a bunch of tasks continuously on a thread, and the order is not important, you can create a timer object (it has its own thread), and then add each task to it as a TimerTask If you schedule it to delay 0 or 1, it will basically run the task as soon as possible Since timer has only one thread, if you schedule multiple tasks at the same time, it will ensure that only one is run at a time

By the way, I talked to a rim Engineer at the BlackBerry Developer Conference this year. He said that starting with OS 5.0, the number of threads is no longer limited - so this is getting less and less attention

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>