예제 #1
0
NTL_CLIENT



void task(ZZ_pContext context, ZZ_pX *f, vec_pair_ZZ_pX_long  *v)
{
   fprintf(stderr, "starting %s\n", CurrentThreadID().c_str());
   context.restore();
   CanZass(*v, *f);
   fprintf(stderr, "stopping %s\n", CurrentThreadID().c_str());
}
예제 #2
0
파일: fileio.c 프로젝트: axelexic/NTL
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;
}
예제 #3
0
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;
}
예제 #4
0
bool Thread::IsMainThread()
{
    return CurrentThreadID() == mainThreadID;
}
예제 #5
0
void Thread::SetMainThread()
{
    mainThreadID = CurrentThreadID();
}