>>don't want to use boost or AfxBeginThread().

Good luck. So, I'm guessing that if you don't want to use AfxBeginThread() which is just a thin wrapper around CreateThread, then you don't want to use CreateThread either. And if you don't want to use Boost.Thread, then you probably won't want to use any other library solution for multi-threading in C++, since Boost is by far the best, fastest, easiest and most robust implementation for multi-threading in C++ (in fact, it will become part of the C++ standard library before the end of this year, that's how good it is).

You have asked a question, but you also ruled out all the possible answers, from the lowest-level functions (i.e. CreateThread from the win32 API), to the most user-friendly high-level library solution (i.e. Boost). What do you expect?

The only other solution I can think of is a parallel processing solution, that is, OpenMP or Intel's TBB. But that can easily be overkill, and won't be very easy to use (it is professional stuff).

Maybe you should give more details as to why you reject Boost or AfxBeginThread, and what you are looking for in a solution for multi-threading.

>>Oh, and it works in /MD[d], /MD, MFX.
Don't worry about that, they all will work fine with those (if fact, you need /MD, it is not optional if you want to do multi-threading).

I just want to understand the algorithm of this and how we can write it in c++ ourselves in lowest-level that is possible.

There must be someone professional who can do that.

This question has already been answered. Start a new discussion instead.