Beispiel #1
0
/*	Returns subconfig names list
 */
bool LuaConfig::getSubconfigsList( std::string config, std::vector< std::string >& ret )
{
	const int prmsz = 1;
	const char* prm[prmsz] = { config.c_str() };
	bool res = execFunction("configs:getSubconfigsList", prm, prmsz, ret);
	return res;
}
Beispiel #2
0
bool LuaConfig::getSubconfigsLength( std::string config, int& len )
{
	const int prmsz = 1;
	const char* prm[prmsz] = { config.c_str() };
	bool res = execFunction("configs:getSubconfigsLength", prm, prmsz, len);
	return res;
}
void *workerThreadWait(void *tData)
{
  threadData *td = (threadData*)tData;
  parallelArguments
    *pArgs = td->pArgs;
  int
    myCycle = 0;

  const int 
    n = numberOfThreads,
    tid = td->threadNumber;

#ifndef PORTABLE_PTHREADS
  pinToCore(tid);
#endif
 
  printf("This is worker thread number: %d\n", tid);

  while(1)
    {
      while (myCycle == threadJob) 
	;
      myCycle = threadJob;
      execFunction(pArgs, tid, n);   
      barrierBuffer[tid] = 1; 
      
    }

  return (void*)NULL;
}
Beispiel #4
0
//TODO: Как-то оно не так делает.
std::string LuaConfig::getRandom( std::string field, std::string config )
{
	std::string ret;
	const int prmsz = 2;
	const char* prm[prmsz] = { field.c_str(), config.c_str() };
	execFunction("configs:getOneFromSeveral", prm, prmsz, ret);
	return ret;
}
Beispiel #5
0
bool LuaConfig::OpenConfig( std::string filename )
{
	const int prmsz = 1;
	bool ret;
	const char* prm[prmsz] = { filename.c_str() };
	execFunction("configs:load", prm, prmsz, ret);
	return ret;
}
Beispiel #6
0
bool LuaConfig::LoadAll( std::string type )
{
	const int prmsz = 1;
	bool ret;
	const char* prm[prmsz] = { type.c_str() };
	execFunction("configs:loadAll", prm, prmsz, ret);
	return ret;

}
void masterBarrier(int jobType, parallelArguments *pArgs)
{
  const int 
    n = numberOfThreads;
  
  int 
    i, 
    sum;

  jobCycle = NOT jobCycle;
  threadJob = (jobType << 16) + jobCycle;

  execFunction(pArgs, 0, n);
 
  do
    {
      for(i = 1, sum = 1; i < n; i++)
	sum += barrierBuffer[i];
    }
  while(sum < n);  

  for(i = 1; i < n; i++)
    barrierBuffer[i] = 0;
}