wgtmac - 2012-07-31

Hi, I have a small problem but it's hard for me to understand. This project is using latest version of zthread and built into static library (.lib) in visual studio 2005 or 2010.

Here is my simple code.

#include "zthread/PoolExecutor.h"  
using namespace ZThread;  
  
class B : public Runnable   
{  
    public:  
    B() {}
        void run() {  // whether here is anything or not, this problem always exists. }  
};
int main()   
{  
    PoolExecutor executor(1);  
    for (__int64 j=0; j != 10000000; j++)
    {
        executor.execute(new B());
        executor.wait();
    }
    system("pause");
}

In debug mode, this code my report a assert in win32/Fastlock.h, Line 105.
That is the assert in the following code:

  void release() {
#ifndef NDEBUG
    _locked = false;
#endif
    if(::ReleaseMutex(_hMutex) == 0) {
      assert(0);
      throw Synchronization_Exception();
    }
  }

Anyone knows this issue? Thank you.