Monthly Archives: June 2013

Invisible Races

When you’re writing multi-threaded applications, the problem you are working hardest to avoid is that of data races. Here’s an example (assume a 32-bit x86 system): int global = 0; void thread1() { global += 1; } void thread2() { global = 0x10000; } The race here is pretty obvious. Two threads are accessing the […]

Posted in FussyLogic | Tagged , , | Leave a comment

Copy and Swap Idiom

I learned a new trick today, while reading about C++11 (of which more to come). It’s a technique I wish I’d known about a long time ago, as it addresses an issue I’ve always thought C++ had – forcing you to duplicate code. That issue is addressed even more thoroughly with C++11, which has introduced […]

Posted in FussyLogic | Tagged , , | Leave a comment

UNIX’s Achilles’ Heel I

UNIX has one (to my mind) big hole in its API. Windows, surprisingly, doesn’t share it. This article will discuss that gap, and how it can be worked around. File Descriptor Wakes There are a few multiplexing system calls, select(), poll(), and epoll() that put a thread to sleep, with the wakeup triggered by activity […]

Posted in FussyLogic | Tagged , , , | Leave a comment

Android Authenticators II

Last time we saw how to make Android support our own custom account type. This time we’ll see how to make use of that account type in our own application. How does our app call getAuthToken()? Get an account name of the appropriate type (i.e. our custom type) If there are no accounts: start an asynchronous […]

Posted in FussyLogic | Tagged , , , , | Leave a comment

Android Authenticators I

I found a blog that gave an example of how to make a custom authenticator for Android. I didn’t find it very clear, so this article covers my understanding that I’ve pulled this together from the example given by that blog author, and from the Android documentation, and then building something that works. To make […]

Posted in FussyLogic | Tagged , , , , | Leave a comment