The class that execute time-consuming
s, but differently
, execute them concurrently and not one after the other.
Most of the times, the best choice for having synchronous behavior is
so please think twice before using this class.
A typical usage of this class is, for example, in an application with multiple tabs
where the user triggers the loading of the content of the tab by clicking on it,
and where tab loading is time-consuming; in such scenario, the behavior of
would be to load the first tab and only when the first tab is loaded
start loading the second tab.
The behavior of ConcurrentWorker would be to load the tabs concurrently.
Needless to say, this concurrent behavior imposes further care in designing the
system to respect thread safety, and to keep the system simple to understand.
This approach is very similar to the asynchronous behavior, but with the advantages
of the synchronous model in code readability.