One of the ignored points about thread usage is just how expensive are the synchronization mechanisms. It is a good idea to apply Occam's Razor to your design and eliminate unnecessary features and have a result which provides a better level of functionality and a structure which is much simpler to prove correct.

I see situations where there is a complex web of worker threads etc applied to what would otherwise be a simple problem. The result runs slowly and has hidden race conditions and other defects. DRH's reservations about threads come to mind.

Applications run best when they can be reduced to a single stream without any synchronization requirements.

Threads are indispensible when multiplexing a user interface but are very dispensible when handling a single resource like a database.

Joe Wilson wrote:
--- Ken <[EMAIL PROTECTED]> wrote:

In general I'v found that Thread cancellation is very painful,
a simpler paradigm to utilize is the lock timeout with a Global variable status check.


Rather than check a global variable you could simply pass a null
event to the queue which instructs the thread to simply to finish
(a.k.a. return) gracefully. That way you can avoid the lock timeout
and polling.

On the GUI thread, however a timeout and poll may be necessary depending on the framework.


      
____________________________________________________________________________________
Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to