The DBConnectionSingleton Class
The DBConnectionSingleton Class The DBConnectionSingleton class is the implementation of a database connection-specific object pool. The main purpose of this class is to provide database connection-specific implementations of the Create()Citeste tot ... 162 cuvinte
Dimensiune mica - fara poza |
|
|
The AutoResetEvent Class
The AutoResetEvent Class The AutoResetEvent class works in a similar way to the ManualResetEvent class. It waits for the timeout to take place or the event to be signaled and then notifies the waiting threads about the event. One importanCiteste tot ... 142 cuvinte
Dimensiune mica - fara poza |
|
|
Networking in .NET
Networking in .NET Prior to the advent of the .NET Framework, the ability to develop sophisticated Windows-based networking applications was limited to advanced C++ programmers using the convoluted WinSock library for the most part. There wCiteste tot ... 6880 cuvinte
Dimensiune mare + cu imagini |
|
|
End-to-End Examples
End-to-End Examples In this section of the chapter we will take a look at two larger examples. First, we'll take a look at creating thread-safe wrappers and then move on to a database connection pool. Writing Your Own Thread-Safe WrappersCiteste tot ... 1432 cuvinte
Dimensiune mica + cu imagini |
|
|
Scalability in .NET
Scalability in .NET If you have a multiprocessor system, then you'll see threads really show their worth. The Windows OS manages the allocation of threads to processors and, as you have seen throughout this book, firing any process automatiCiteste tot ... 1730 cuvinte
Dimensiune medie - fara imagini |
|
|
Programming the Thread Pool in C#
Programming the Thread Pool in C# The previous sections of the chapter dealt with theoretical aspects of using thread pools in the .NET Framework. Now it's time for us to cover the programmatic aspects of creating and using thread pools inCiteste tot ... 1507 cuvinte
Dimensiune medie + cu poze |
|
|
The ObjectPool Class
The ObjectPool Class Let's start our discussion of the ObjectPool class by listing it in its entirety: using System; using System.Collections; using System.Timers; namespace WroxCS internal ObjectPool() proCiteste tot ... 647 cuvinte
Dimensiune mica - fara poza |
|
|
Threading Traps
Threading Traps We've seen the two main situations where it can be a good idea to use threading in your applications. However, there are some circumstances in which spawning a new thread would be a bad idea. Obviously, this isn't going to be aCiteste tot ... 1156 cuvinte
Dimensiune mica - fara poza |
|
|
The Enter() and Exit() Methods
The Enter() and Exit() Methods It is important to note that the Monitor methods are static and can be called on the Monitor class itself rather than an instance of that class. In the .NET Framework, each object has a lock associated withCiteste tot ... 926 cuvinte
Dimensiune mica + cu imagini |
|
|
What is Thread Pooling
What is Thread Pooling? Thread pooling is the process of creating a collection of threads during the initialization of a multithreaded application, and then reusing those threads for new tasks as and when required, instead of creating new threaCiteste tot ... 481 cuvinte
Dimensiune mica - fara poza |
|
|
Threading in .NET
Threading in .NET Overview In Chapter 1 we described what threading is. We covered a lot of the common ground that many may be familiar with already. Knowing the what portion of threading is important. In this chapter, you will see how tCiteste tot ... 8794 cuvinte
Dimensiune mare + cu imagini |
|
|
The lock Statement
The lock Statement The lock keyword can be used as an alternative to the methods of the Monitor class. The following two blocks of code are equivalent: Monitor.Enter(x) Monitor.Exit(x) lock(this) The following examCiteste tot ... 132 cuvinte
Dimensiune mica - fara poza |
|
|
Peer Thread Model
Peer Thread Model The next threading model we will describe is the Peer threading model. In this threading model, each thread will receive its own input from the appropriate sources and process that input accordingly. This model is illustrCiteste tot ... 664 cuvinte
Dimensiune mica + cu imagini |
|
|
Main and Worker Thread Model
Main and Worker Thread Model This is the commonest model and the one used throughout this book so far. It is illustrated in Figure 3: Figure 3 In the Main and Worker thread model, the main thread receives all input and passes itCiteste tot ... 488 cuvinte
Dimensiune mica + cu imagini |
|
|
Multiple Threads in Applications - STA Threading Model
Multiple Threads in Applications If you programmed in versions of VB prior to .NET, you might know that VB supported multiple threads within a COM container, such as MTS or COM+. Well, although multiple threads were supported by VB5/6, theCiteste tot ... 1694 cuvinte
Dimensiune medie + cu poze |
|
|
The BooleanSwitch Class
The BooleanSwitch Class Using this class in the traced code, you can decide to activate/deactivate messages by simply changing a value in the application configuration file. The WriteLineIf() and WriteIf() methods will be useful to write meCiteste tot ... 209 cuvinte
Dimensiune mica - fara poza |
|
|
The TextWriterTraceListener Class
The TextWriterTraceListener Class We are going to conclude our listener explanation by examining the TextWriterTraceListener class. It is useful when you have to write our tracing messages to a text file or directly in a console applicationCiteste tot ... 514 cuvinte
Dimensiune mica + cu imagini |
|
|
The ThreadStaticAttribute Class
The ThreadStaticAttribute Class ThreadStaticAttribute is used on a static variable to create a separate variable for each thread executing it, rather than sharing (default behavior) the static variable across threads. This means that a staCiteste tot ... 618 cuvinte
Dimensiune mica - fara poza |
|
|
Why Worry About Synchronization
Why Worry About Synchronization? There are two main reasons why any .NET developer needs to keep synchronization in mind when designing a multithreaded application: § To avoid race conditions § To ensure threadsafety Since the .NETCiteste tot ... 1180 cuvinte
Dimensiune mica + cu imagini |
|
|
Exploring the ThreadPool Class
Exploring the ThreadPool Class In this section, we will be exploring the various aspects of the ThreadPool class and will see how they can be employed to create thread pools in our .NET applications. The ThreadPool class provides a pool ofCiteste tot ... 1158 cuvinte
Dimensiune mica - fara poza |
|
|
Alte pagini