Condition Variables

You work in a bar, pouring pints for the locals. One of your regulars comes in; he’s looking pretty grumpy today. “Whiskey” he snaps. You put down a glass and pour. You finish pouring and he necks back the drink. “Again”, he snaps. Again, you pour and as soon as you finish he necks it. This repeats two or three more times before the grumpy man slams down the money for his tab and leaves. Congratulations, you have just taken part in a “Producer/Consumer” exchange.

Continue reading “Condition Variables”

LRU Cache Implementation

One of the problems any developer will eventually have to resolve is one of latency; specifically, being able to retrieve and process data in a timely fashion.  This issue can come in many guises but they generally manifest as needing to read data from a backing store that cannot deliver the high performance needed by the application. This can be a tricky problem to solve but the general method is to implement some form of caching. The remainder of this article will discuss one caching mechanism, called the LRU Cache.

Continue reading “LRU Cache Implementation”

C++11 r-value references

The C++03 standard treats temporary types as r-values (types only meant to go on the right hand side of an assignment expression). As such, it is only possible to bind a temporary to a const reference type. This is a somewhat arbitrary and, often, frustrating rule. The original idea was that there would be no good reason to modify a temporary; however, it turns out that there are plenty of good reasons for doing so and this arbitrary restriction was just a nuisance that served no good cause.

Continue reading “C++11 r-value references”

Technical Debt

Regular readers (do I actually have any, I wonder?) of my blog may be wondering why I’ve not posted any new content for the last few weeks. First off, let me apologise for this. Secondly, let me explain why: I’ve been busy… in my new job! That’s right, ladies and gentlemen, everyone’s favourite evil one has finally found himself employment again.

Continue reading “Technical Debt”