LA.NET [EN]

June, 2009Archive

Jun 09

Multithreading: waiting on the APM’s WaitHandle

Posted in C#, Multithreading       Comments Off on Multithreading: waiting on the APM’s WaitHandle

Today, we’re going to keep looking at the available options waiting for the conclusion of an asynchronous task started through the APM model. In this post we’re going to see how we can use the WaitHandle which we can get through the IAsyncResult’s AsyncWaitHandle property. After getting a valid reference to it, you can do […]

Read the rest of this entry »

Jun 09

Ok, after installing and playing a little bit with the latest version of Ubuntu, I guess that I need a decent app for writing blogs (that’s the only way I’ll end up using the OS since I tend to write at night). Since my google searching abilities aren’t returning anything decent, I was wondering if […]

Read the rest of this entry »

Jun 09

Friend assemblies and strong names

Posted in C#, Trivia       Comments Off on Friend assemblies and strong names

Before getting started, I’d like to say that I don’t really use friend assemblies much. However, there are times where using friend assemblies is a must and in those cases, you might end up getting into the problem I had. For starters, you need to use the InternalsVisibleToAttribute to signal a friend assembly. In my […]

Read the rest of this entry »

Jun 09

Multithreading: blocking the thread by calling EndXXX directly

Posted in Uncategorized       Comments Off on Multithreading: blocking the thread by calling EndXXX directly

As we’ve seen, one of the available options is blocking the thread by calling the EndXXX method directly. This might be a good option when you only need to do one or two small tasks and then you need to wait until the asynchronous operation is completed. In practical terms, this option won’t be usable […]

Read the rest of this entry »

Jun 08

Note to self: installing Linux through USB

Posted in Linux       Comments Off on Note to self: installing Linux through USB

I know I’ll need it tomorrow, so I’ll just put it on the blog for future use…

Read the rest of this entry »

Jun 08

J.D. Meier on productivity personas

Posted in Trivia       Comments Off on J.D. Meier on productivity personas

An interesting article by J.D.Meier on the several types of personas you might find. I’ve tried to look at the personas and I think I’m “compatible” with: starter doer can do achiever

Read the rest of this entry »

Jun 08

Multithreading: APM and options for waiting until work completes

Posted in C#, Multithreading       Comments Off on Multithreading: APM and options for waiting until work completes

In the last post, we’ve started looking at oldest asynchronous pattern of the .NET framework: the APM model. Today, we’re going to list the available options for waiting to the completion of an asynchronous operation started through a framework that implements APM pattern. After kicking off an asynchronous operation, we have four available options: we […]

Read the rest of this entry »

Jun 08

Multithreading: the IAsyncResult interface

Posted in C#, Multithreading       Comments Off on Multithreading: the IAsyncResult interface

In the last post, we’ve started looking at the APM model used by the .NET framework. Today we’re going to talk about the role played by the IAsyncResult interface. Currently, the IAsyncResult interface has the following members: public interface IAsyncResult {     object AsyncState { get; }     WaitHandle AsyncWaitHandle { get; }     bool […]

Read the rest of this entry »

Jun 07

Multithreading: introducing the asynchronous programming model

Posted in C#, Multithreading       Comments Off on Multithreading: introducing the asynchronous programming model

Today we’re going to keep looking at multithreading on the .NET framework and we’re going to start talking about the oldest async model you’ll find in the .NET framework: the APM (asynchronous programming model). You might be asking why you need an asynchronous programming model and why shouldn’t you use the threads or thread pool […]

Read the rest of this entry »

Jun 05

Now that we’ve ended our study of the thread pool, you know that we’ve got two ways of spanning new threads for performing work in parallel: we can manage the thread lifetime by using the Thread class directly or we can rely on thread pool for managing threads for us. Since there are options, you […]

Read the rest of this entry »

Jun 04

Multithreading: I/O and the thread pool

Posted in C#, Multithreading       Comments Off on Multithreading: I/O and the thread pool

When we started looking at how we could use the thread pool for asynchronous work, I (only!) mentioned three options: use the pool to run a task when IO completes; run a (possible recurrent) task at a specific time; execute a task when a kernel object is signaled. There is still another option: you can […]

Read the rest of this entry »

Jun 03

At least, my answers, that is… A few days ago, I’ve published a quiz I’ve found on Dan Garcia’s class. The question was: which snippets prints always 5? 1,,) main() {    int *a-ptr; *a-ptr = 5; printf(“%d”, *a-ptr); } 2) main() {   int *p, a = 5;   p = &a; …   […]

Read the rest of this entry »

Jun 03

Multithreading: coding the register wait pattern

Posted in C#, Multithreading       Comments Off on 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(string[] args) { […]

Read the rest of this entry »

Jun 03

Is this true?

Posted in Trivia       Comments Off on Is this true?

Saw it on Sava’s blog. If it’s true, it’s going to be amazing!

Read the rest of this entry »

Jun 02

Multithreading: registered waits

Posted in C#, Multithreading       Comments Off on 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 callback […]

Read the rest of this entry »

Jun 01

Fair play is a b*tch

Posted in Trivia       Comments Off on Fair play is a b*tch

[Not technical, so you probably want to skip it unless you’re Portuguese or want to see how bad things are around here] In Portugal, there was a football (soccer, if you’re in US) coach which said something like “fair play is a bitch”. I guess he was right…in fact, I tend to go a little […]

Read the rest of this entry »

Jun 01

Are you using bing?

Posted in Trivia       Comments Off on Are you using bing?

I’ve tried it and didn’t dislike it (which is something new when I think about previous MS tries on the search engine world)…

Read the rest of this entry »

Jun 01

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, object state, int dueTime, int period); […]

Read the rest of this entry »

Jun 01

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 we’ve […]

Read the rest of this entry »