关于多线程同步的一点总结
这两天看了下 MoreWindows 《秒杀多线程》系列的博客,稍微总结一下,就当笔记了。 http://blog.csdn.net/column/details/killthreadseries.html 1. CreateThread()与_beginthreadex()的区别 _beginthreadex在创建线程前(即调用CreateThread()前),先申请了一个用于存放线程私有数据的 _tidata 类型成员. 2. Interlocked系列函数 * LONG __cdecl InterlockedIncrement(LONG volatile* Addend); 相当++Addend; * LONG __cdecl InterlockedDecrement(LONG volatile* Addend); --Addend; * LONG __cdecl InterlockedExchangeAdd(LONG volatile* Addend, LONG Value); Addend + Value; 减法即Value取负值 * MSDN上对WaitForMultipleObjects()函数第一个参数作了说明:The maximum number of object handles is MAXIMUM_WAIT_OBJECTS(64)。 3. 多线程同步