The Old New Thing

A high waiter count on a free critical section may indicate a lock convoy

If you're debugging a performance problem in your application, you may run across a critical section in a very strange state: A lot of threads are waiting for it, but nobody owns it! This state means that the previous owner of the critical section has just exited it and signalled a waiting thread to take it, but that thread hasn't yet ...
Comments are closed.0 0
Code

What does an invalid handle exception in LeaveCriticalSection mean?

Internally, a critical section is a bunch of counters and flags, and possibly an event. (Note that the internal structure of a critical section is subject to change at any time—in fact, it changed between Windows XP and Windows 2003. The information provided here is therefore intended for troubleshooting and debugging purposes...

Throwing things into a blender and seeing what happens

Manufacturer of commercial and home blenders Blendtec has produced a marketing web site Will It Blend? which features short videos of the company's CEO and new Internet blending icon Tom Dickson throwing all sorts of unusual objects into one of their blenders, to see what happens. (The videos are also on YouTube, and of course they have a ...

Do not overload the E_NOINTERFACE error

One of the more subtle ways people mess up IUnknown::QueryInterface is returning E_NOINTERFACE when the problem wasn't actually an unsupported interface. The E_NOINTERFACE return value has very specific meaning. Do not use it as your generic "gosh, something went wrong" error. (Use an appropriate error such as E_OUTOFMEMORY or E_ACCESSDENIED...
Comments are closed.0 0
Code

Okay, I changed my mind, I wrote a book after all

Back in 2003, I wrote that I'm doing this instead of writing a book. That was true then, but last year I decided to give this book thing another go, only to find that publishers generally aren't interested in this stuff any more. "Does the world really need another book on Win32? Nobody buys Win32 books any more, that dinosaur!" "A ...

The wisdom of seventh graders: What to do with a time machine (part 3)

(Continuing from part 2.) Here are more sentences from seventh grade time travel essays. Remember, these sentences are not representative of seventh grade writing in general; these are just the funny bits. World History The Future: Most students who travelled to the future wanted to meet themselves. Letter Format: Some students took ...

If you let people read a file, then they can copy it

Here's a question that floated past my view: How do I set the ACLs on a file so users can read it but can't copy it? I can't find a "Copy" access mask that I can deny. If I can't deny copying, I'd at least like to audit it, so I can tell who made a copy of the file. There is no "Copy" access mask because copying is not a fundamental file ...

The wisdom of seventh graders: What to do with a time machine (part 2)

(Make sure you've read Part 1 for background information.) On the subject of where they would go in a time machine, many students wrote well-thought-out essays, beautifully composed. These sentences below did not come from those essays. I've categorized the snippets roughly by theme, though I had to guess at some of them since the ...

How do I find all files with at least one space in their name?

You already know how to do this, you just don't realize it. How do you find files with an "x" in their name? That's right, you use dir *x*. Now you just have to change that x to a space. And since spaces are command line delimiters, you need to quote the sequence so it gets treated as a single parameter rather than two "*" parameters: ...

The wisdom of seventh graders: What to do with a time machine (part 1)

All the students at a local school were asked to composed an in-class essay on the following topic: "Your science teacher has invented a time machine. You have been selected to take the first trip. Explain in a multi-paragraph letter to your teacher where you will go and why." (Students were given two hours, plus one additional hour upon ...

Feedback usabilla icon