Thursday, December 18, 2014

What is the difference between mutex and critical section on Windows?

There are main differences between mutex and critical section on Windows:
  1. Mutex is a kernel object. Critical section is implemented with using interlocked operations and in rare cases it uses event.
  2. In most cases critical section doesn't require switches from user mode to kernel mode, that is why it is much faster than mutex in general.
  3. Mutex can be used for synchronization of threads between different processes, but critical section can't be.
  4. Mutex can be named, but critical section can't be.
  5. Thread can wait for a mutex with using timeout, but when it is locked on critical section then timeout parameter doesn't supported.

Tuesday, December 9, 2014

Why do I get this error LNK2019: unresolved external symbol __malloc_dbg referenced in function?

I've faced with the same issue several minutes ago.
It has happened because I had set /MT by mistake instead of /MTd:

It was:


but it should be: