Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting
by Matthew MacDonald
Custom Threaded Objects
Technically, there is no relation between threads and objects. A single method in an object can be executed by several different threads, and a single thread can span multiple methods in different objects. However, it’s often useful to create a dedicated class that encapsulates everything a thread needs. This provides an easy way to associate pieces of required information with a thread and overcome the fundamental limitation that a thread can execute only methods that take no parameters.
Consider, for example, the asynchronous calls to an imaginary stock quote XML Web service, which we considered earlier in the chapter. The GetStockQuote Web method required a single ticker parameter and returned a decimal with price information. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access