Browse Site by Tags

Showing related tags and posts across the entire site.
  • Multithreading: coding the register wait pattern

    Yesterday we’ve looked at the theory behind registered waits (btw, there were some errors on that post, but I think I’ve corrected them now). Today, we’re going to look at some code. Let’s see what happens when we use a ManualResetEvent for waiting on: class DumbHandle : WaitHandle { } static void Main...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Wed, Jun 3 2009
    Filed under: C#, Multithreading
  • Multithreading: registered waits

    In this post, we’re going to keep looking on how we can reuse the thread pool’s threads for executing specific tasks. This post is all about registered waits. A registered wait allows us to specify a callback that will be invoked when a predefined kernel object is signaled. In .NET, we register a wait...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Tue, Jun 2 2009
    Filed under: C#, Multithreading
  • Multithreading: running tasks at a specific time

    As we’ve seen , we can also use the thread pool for executing a (possible recurring) task at a specific time. To do that, we need to take a look at the Timer class. Initializing a timer is done through one of its constructors: public Timer(TimerCallback callback); public Timer(TimerCallback callback...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Mon, Jun 1 2009
    Filed under: C#, Multithreading
  • Multithreading: waiting for several work items

    In the last post , we’ve seen how we could use the thread pool for queuing work items that will be executed in one of the existing threads maintained on the default thread pool. As we’ve seen, there’s no way to say “wait for the executing actions” without using one of the synchronization kernel objects...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Mon, Jun 1 2009
    Filed under: C#, Multithreading
  • Multithreading: queuing work items

    As we’ve seen in the last post of the series , we can use the thread pool for scheduling several “types” of asynchronous operations and to amortize the penalty we pay when we need to create extra threads. In fact, I’d say that most operations should be performed by using a thread from the thread pool...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Thu, May 28 2009
    Filed under: C#, Multithreading
  • VS 2010 color scheme patch

    If you enjoy dark themes and love VS 2010, then you know you’re into trouble. The problem is that VS looses the dark background after being closed and you need to go to the options, fonts and colors and then apply the current settings (which still have the correct color) again. The good news is that...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Thu, May 28 2009
    Filed under: C#, VS
  • Multithreading: introducing the thread pool

    Until now, we’ve been starting threads by creating instances of the System.Threading.Thread class in the samples. Thread creation isn’t cheap! If we’re creating a thread just to run a small task, then the thread’s creation might completely outweigh the advantage of running such a small task. In most...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Wed, May 27 2009
    Filed under: C#, Multithreading
  • Using condition variables

    A few posts ago , we’ve seen how we could create a producer/consumer stack. Let’s update the example for using condition variables. Here’s the code: class ConcurrentStack<T> {     private readonly Object _locker = new Object();     private readonly Stack<T> _stack...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Wed, May 27 2009
    Filed under: C#, Multithreading
  • Multithreading: condition variables

    There are times when a thread needs to wait  for a specific condition to be true. Since this condition tends to involve shared state, then you know that you must use some sort of synchronization to ensure proper update of the data used by the condition. When we looked at kernel objects, we’ve seen...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Wed, May 27 2009
    Filed under: C#, Multithreading
  • Multithreading: reader/writer locks

    In the previous posts, we’ve seen how we can use monitors and any CLR object for getting a critical region. Whenever you need to get a critical region, using a CLR lock for ensuring proper access. However, there will be times when, for instance, you’ll have much more reads than writes. In these cases...
    Posted to LA.NET [EN] (Weblog) by luisabreu on Tue, May 26 2009
    Filed under: C#, Multithreading
Page 1 of 94 (932 items) 1 2 3 4 5 Next > ... Last »