void DFUTransportUSB::init()
{
	if(init_counter.inc() == 1)
	{
		map = new CMapX<CStringX, const TCHAR *, CStringX, const TCHAR *>;
		lockMap = new CriticalSection;
	}
}
void DFUFileInfoCache::init()
{
	if(init_counter.inc() == 1)
	{
		map = new CMapX<CStringX, const TCHAR *, DFUFileInfoCache::Cache, DFUFileInfoCache::Cache &>;
		lockMap = new CriticalSection;
	}
	DFUFileCache::init();
}
Exemple #3
0
const string& UniqueID()
{
   static AtomicCounter cnt; // a GLOBAL counter
   

   NTL_THREAD_LOCAL static string ID;
   NTL_THREAD_LOCAL static bool initialized = false;
   NTL_THREAD_LOCAL static unsigned long local_cnt = cnt.inc();
   NTL_THREAD_LOCAL static unsigned long local_time = time(0);
   NTL_THREAD_LOCAL static unsigned long local_clock = clock();

   if (!initialized) {
      stringstream ss;
      ss << local_cnt << "-" << local_time << "-" 
         << local_clock << "-" << GetPID()  << "-" << CurrentThreadID();  
      ID = ss.str();
      initialized = true;
   }

   return ID;
}
const string& UniqueID()
{
   static AtomicCounter cnt; // a GLOBAL counter
   

   NTL_TLS_LOCAL(string, ID);

   NTL_TLS_LOCAL_INIT(bool, initialized, (false));
   NTL_TLS_LOCAL_INIT(unsigned long, local_cnt, (cnt.inc()));
   NTL_TLS_LOCAL_INIT(unsigned long, local_time, (time(0)));
   NTL_TLS_LOCAL_INIT(unsigned long, local_clock, (clock()));

   if (!initialized) {
      stringstream ss;
      ss << local_cnt << "-" << local_time << "-" 
         << local_clock << "-" << GetPID()  << "-" << CurrentThreadID();  
      ID = ss.str();
      initialized = true;
   }

   return ID;
}