Piotr Caban (@piotr) commented about dlls/msvcrt/concurrency.c:
+static void CALLBACK chore_wrapper_finally(BOOL normal, void *data) +{
- _UnrealizedChore *chore = data;
- LONG prev_finished, new_finished;
- volatile LONG *ptr;
- TRACE("(%u %p)\n", normal, data);
- if (!chore->task_collection)
return;
- ptr = &chore->task_collection->finished;
- chore->task_collection = NULL;
- do {
prev_finished = *ptr;
if (prev_finished == 0x80000000)
I guess that native uses some values/bits as flags. Probably 0x80000000 means that something is not initialized. Probably there's no point in trying to behave exactly the same as long as we don't need to do any initialization. I think it's better to initialize it to 0 and use simple InterlockedIncrement.
If 0x80000000 is really needed please add a define with meaningful name instead of using magic constants.