WaitForMultipleObjects and WIN32 events for Linux/OS X/*nix and Read-Write Locks for Windows

As every programmer worth his salt knows, synchronization primitives form the very building blocks of multithreaded programming. Without them, the world as we know it would cease to exist and chaos would reign free and unchecked.

All joking aside, synchronization objects such as mutexes and semaphores are essential to safe multithreading and are found on just about any platform under the sun. Mutexes and semaphores alike have one purpose: to keep different threads from messing around with bits and bytes at the same time another thread is, keeping your code free of segfaults and memory access violations alike. But that’s about where the similarities between the synchronization primitives on different platforms end.

POSIX-compliant operating systems with pthreads offer additional really neat synchronization primitives not found on Windows, such as condition variables and read-write locks (the latter is now available on Windows Vista+). And Windows programmers have at their disposal automatic and manual reset events, which make designing certain types of multithreaded software incredibly easy, abstracting away much of the hard-core synchronization logic that lies beneath the hood.

Continue reading

The Woes of Windows Vista/7 Mapped Network Drives

One of the biggest, bestest, and most-hyped features of Windows Vista (according to Microsoft, that is) was the brand spanking new TCP/IP networking stack. Ask us, it sucks. Network performance hasn’t improved any over the ancient stack used in XP (nor should it – it’s not like there’s anything new in IPv4) though it does add better IPv6 support out-of-the-box and ships with some even more functionality in Windows 7. But more importantly, Microsoft threw out decades of testing and quality assurance work on the existing Networking Stack and replaced it with something rather questionable.

We’ll be following up some more on this topic from a technical side later in another article, but for now, an example that most of you are sure to have come across if you’ve ever tried to map network drives before:

This popup is shown at system startup if you have any mapped network drives to UNC shares which are not protected with a username and password. If you map a network destination that does require authentication, Windows will map the drive OK. To further complicate matters: this message is shown only when you startup from a cold boot! If you restart your PC (vs shutdown and powerup), it won’t appear.

Resolving the issue is straight-forward enough: just double-click on the network drive in My Computer and it’ll automatically, instantly, and silently connect. Which makes one wonder why Windows couldn’t connect in the first place.

Good question.

Continue reading

Does it GTK/QT/Win32 Really Matter for Chrome?

128px-GoogleChromeLogo.pngA recent article on OSNews highlights the changes expected to come in Google’s Chrome 2.0 for Windows and the progress being made on the Linux and OS X fronts for Google’s new browser.

In the article, Ben Goodger, lead Chrome UI developer, states

[Google avoids] cross platform UI toolkits because while they may offer what superficially appears to be a quick path to native looking UI on a variety of target platforms, once you go a bit deeper it turns out to be a bit more problematic.” [… Your applications end up] speaking with a foreign accent.

But there’s something we’re not getting here. Obviously given enough brilliant programmers and a good team lead to keep the different codebases in sync, going with native APIs is the better approach. But the reasons Goodger is offering aren’t very convincing.

Continue reading