Beispiel #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());
}
Beispiel #2
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;
}
Beispiel #4
0
bool Thread::IsMainThread()
{
    return CurrentThreadID() == mainThreadID;
}
Beispiel #5
0
void Thread::SetMainThread()
{
    mainThreadID = CurrentThreadID();
}