Example #1
0
static void testThreads( const char* testname, int times)
{
	int ti = 0, te = times;
	for (; ti != te; ++ti)
	{
		int start = ti + 1000 + 1;
		int nofThreads = ti*10;
		std::cerr << "starting test " << testname << "." << ti << " (" << (2*nofThreads) << " threads ..." << std::endl;
		GlobalCounter obj( start);
		std::vector<strus::shared_ptr<strus::thread> > threadGroup;

		for (int si=0; si <= nofThreads; ++si)
		{
			strus::shared_ptr<strus::thread> th( new strus::thread( &GlobalCounter::run, &obj, ti * 1000, si));
			threadGroup.push_back( th);
		}
		for (int si=0; si <= nofThreads; ++si)
		{
			strus::shared_ptr<strus::thread> th( new strus::thread( &GlobalCounter::run, &obj, ti * 1000, -si));
			threadGroup.push_back( th);
		}
		std::cerr << "waiting for threads to terminate ..." << std::endl;
		std::vector<strus::shared_ptr<strus::thread> >::iterator gi = threadGroup.begin(), ge = threadGroup.end();
		for (; gi != ge; ++gi)
		{
			(*gi)->join();
		}
		std::cerr << "done" << std::endl;
		obj.checkCounter( start);
	}
}
Example #2
0
void th(int n, char a, char b, char c)
{
    if (n == 1)
    {
        printf("\n Move disk 1 from  %c to  %c",a,c);
        return;
    }
    th(n-1,a,b,c);
    printf("\n Move disk %d from %c to %c",n,a,c);
    th(n-1,a,b,c);
}
/* treecopy assumes that n[0-n] is filled with zeros*/
 void __treecopy(caps_t o, 
                 struct _XTreeHandle *n, int len, 
                 unsigned int tid, 
                 struct hashtable **h) {
  int i;
  //initialize fresh memory
  memset(n,0,len*sizeof(struct _XTreeHandle));
  // create new tree with the appropriate capabilities
  for(i=0;i<len;i++) {
    struct _XTreeHandle *t = th(o,i);
    n[i].caps.rcnt = o[i].rc;
    n[i].caps.wr_cnt = o[i].wc;
    n[i].caps.rd_cnt= o[i].lc;
    n[i].h = t->h;
    hashtable_insert(h,n+i); // create mapping

    //increment ref count of this region
      __sync_fetch_and_add(&t->h->caps.rcnt,1);
    t->h->single_thread_key = 0; //not thread local
    if(o[i].wc) { // transfer writer capabilities
      if( tcb()->tid == t->h->caps.writer_cv) {
        t->h->caps.writer_cv = tid;
      } else
        errquit("_treecopy: writer_cv"); 
    }
    //if there exist read capabilities, increment read count
    if(o[i].lc)
      __sync_fetch_and_add(&t->h->caps.rd_cnt,1);

#ifdef __RUNTIME_MEMORY_DEBUG_LOCKOP
    print_xtree(n+i,0);
#endif
    struct _XTreeHandle *parent= t->parent_key;
    int idx;
    if(parent)
       for(idx=0;idx<len && th(o,idx) != parent;idx++);
    else
       idx = len;
    if(idx < len) {
      n[i].parent_key = n + idx;
      n[i].next_key =  n[idx].sub_keys;
      n[idx].sub_keys = n + i;
    }  else
      n[i].parent_key = 0;
  }
  //remove capabilities transferred from this tree
  //start off child nodes so that we don't bump into
  //a deallocated node (if a parent gets deallocated
  //its subregions are also removed). Notice that the
  //array "o" is already sorted in the natural 
  //allocation order.
  for(i=len-1;i>-1;i--) 
    _xregion_cap_th(-o[i].rc,-o[i].wc,-o[i].lc,th(o,i));
}
Example #4
0
void VM_ThreadDump::doit() {
  ResourceMark rm;

  ConcurrentLocksDump concurrent_locks(true);
  if (_with_locked_synchronizers) {
    concurrent_locks.dump_at_safepoint();
  }

  if (_num_threads == 0) {
    // Snapshot all live threads
    for (JavaThread* jt = Threads::first(); jt != NULL; jt = jt->next()) {
      if (jt->is_exiting() ||
          jt->is_hidden_from_external_view())  {
        // skip terminating threads and hidden threads
        continue;
      }
      ThreadConcurrentLocks* tcl = NULL;
      if (_with_locked_synchronizers) {
        tcl = concurrent_locks.thread_concurrent_locks(jt);
      }
      ThreadSnapshot* ts = snapshot_thread(jt, tcl);
      _result->add_thread_snapshot(ts);
    }
  } else {
    // Snapshot threads in the given _threads array
    // A dummy snapshot is created if a thread doesn't exist
    for (int i = 0; i < _num_threads; i++) {
      instanceHandle th = _threads->at(i);
      if (th() == NULL) {
        // skip if the thread doesn't exist
        // Add a dummy snapshot
        _result->add_thread_snapshot(new ThreadSnapshot());
        continue;
      }

      // Dump thread stack only if the thread is alive and not exiting
      // and not VM internal thread.
      JavaThread* jt = java_lang_Thread::thread(th());
      if (jt == NULL || /* thread not alive */
          jt->is_exiting() ||
          jt->is_hidden_from_external_view())  {
        // add a NULL snapshot if skipped
        _result->add_thread_snapshot(new ThreadSnapshot());
        continue;
      }
      ThreadConcurrentLocks* tcl = NULL;
      if (_with_locked_synchronizers) {
        tcl = concurrent_locks.thread_concurrent_locks(jt);
      }
      ThreadSnapshot* ts = snapshot_thread(jt, tcl);
      _result->add_thread_snapshot(ts);
    }
  }
}
long __Call_th( CDSR_VMEval& /*vm*/, MMD_Address& addr, UniWord *arg )
{
#if _DEBUG
	if( addr.param2 < 0 )
		throw _T("__Call_(fun) : internal error, out of range");
#endif
	if( addr.param2 == 0 )	// DSRDATA_TYPE_REAL
		*(arg - 1) = CDSRReal( th( (arg - 1)->getReal() ) );
	else					// DSRDATA_TYPE_COMPLEX
		*(arg - 1) = CDSRComplex( th( (arg - 1)->getComplex() ) );
	return 1 - addr.param3;
}
Example #6
0
TYPED_TEST(ThreadSpecificTest, OhterThread)
{
	this->helper_.assign(1);
	std::thread th(&TestFixture::helper_type::make_and_assign, &this->helper_, 2);
	th.join();
	ASSERT_TRUE(this->helper_.equal(1));
}
void CRichEditNcBorder::NcDrawBorder()
{
	Default();

	if (m_bThemedBorder)
	{
		CThemed th(GetCWnd(), WC_EDIT);
		CWindowDC dc(GetCWnd());

		CRect rBorder, rClient;
		GetWindowRect(rBorder);

		th.GetThemeBackgroundContentRect(&dc, EP_EDITTEXT, ETS_NORMAL, rBorder, rClient);
		
		// convert to window coordinates
		rClient.OffsetRect(-rBorder.left, -rBorder.top);
		rBorder.OffsetRect(-rBorder.left, -rBorder.top);

		dc.ExcludeClipRect(rClient);

		// determine the current border state
		int nState;

		if (!IsWindowEnabled())
			nState = ETS_DISABLED;

		else if (HasStyle(ES_READONLY) || SendMessage(EM_GETOPTIONS, NULL, NULL) & ECO_READONLY)
			nState = ETS_READONLY;

		else
			nState = ETS_NORMAL;
		
		th.DrawBackground(&dc, EP_EDITTEXT, nState, rBorder);
	}
}
Example #8
0
void testObj::test<1>(void)
{
  Thread th( (SyncThread(s_)) );
  usleep(100*1000);
  s_.start();
  s_.waitForDone();
}
Example #9
0
int KiekkoNetwork::Update(int threadCount)
{
	if (listen(ListenSocket, SOMAXCONN) == SOCKET_ERROR)
	{
		int errsave = errno;
		printf("listen(...) failed! Error code : %d\n", errsave);
		return 0;
	}
	ClientSocket = INVALID_SOCKET;
	ClientSocket = accept(ListenSocket, 0, 0);

	if (ClientSocket == INVALID_SOCKET)
	{
		printf("accept(...) failed! Error code : EI KINOSTA\n");
		return 0;
	}
	recvThreadMutex.lock();

	std::thread th(NewClient, ClientSocket, threadCount);
	th.detach();

	SendPackage temp = { 0, 0, 0, 0, 0 };

	paskafix = true;
	SendMsg(temp);
	return 1;
}
Example #10
0
TEST(EventLoop, invoke) {
    auto loop = std::make_shared<capnqml::EventLoop>();
    bool invoked = false;
    bool handler_called = false;
    loop->setHandler([&](auto m) -> decltype (auto) {
        handler_called = true;
        return nullptr;
    });
    loop->invoke([&]() {
       invoked = true;
       capnqml::Message msg;
       loop->push(std::move(msg));
    });
    ASSERT_EQ(loop->state(), capnqml::EventLoop::State::Startup); // NOLINT
    std::thread th([=] {
        loop->run();  // NOLINT
    });
    th.detach();
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
    ASSERT_EQ(loop->state(), capnqml::EventLoop::State::Idle); // NOLINT
    loop->cancel();
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
    ASSERT_EQ(loop->state(), capnqml::EventLoop::State::Canceled);
    ASSERT_TRUE(invoked);
    ASSERT_TRUE(handler_called);
}
Example #11
0
	void ReportMessage(const char *message, ...)
	{
		if (!IsEnabled() || CheckSpamLimited())
			return;
		int pos = NextFreePos();
		if (pos == -1)
			return;

		const int MESSAGE_BUFFER_SIZE = 65536;
		char temp[MESSAGE_BUFFER_SIZE];

		va_list args;
		va_start(args, message);
		vsnprintf(temp, MESSAGE_BUFFER_SIZE - 1, message, args);
		temp[MESSAGE_BUFFER_SIZE - 1] = '\0';
		va_end(args);

		Payload &payload = payloadBuffer[pos];
		payload.type = RequestType::MESSAGE;
		payload.string1 = message;
		payload.string2 = temp;

		std::thread th(Process, pos);
		th.detach();
	}
Example #12
0
File: tmr.c Project: soramimi/qSIP
/**
 * Poll all timers in the current thread
 *
 * @param tmrl Timer list
 */
void tmr_poll(struct list *tmrl)
{
	const uint64_t jfs = tmr_jiffies();

	for (;;) {
		struct tmr *tmr;
		tmr_h *th;
		void *th_arg;

		tmr = list_ledata(tmrl->head);

		if (!tmr || (tmr->jfs > jfs)) {
			break;
		}

		th = tmr->th;
		th_arg = tmr->arg;

		tmr->th = NULL;

		list_unlink(&tmr->le);

		if (!th)
			continue;

#if TMR_DEBUG
		call_handler(th, th_arg);
#else
		th(th_arg);
#endif
	}
}
BOOL Ccoin_lookerDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO: 在此添加额外的初始化代码
	auto g_CoinList = LoadCoinList(GetAppDir());
	if (g_CoinList.size())
	{
		int idx = 0;
		for (auto it = g_CoinList.begin(); it != g_CoinList.end(); ++it)
		{
			shared_ptr<ICoinOption> pCoinOption = *it;
			shared_ptr<IUserContext> pWork = create_coin_work(pCoinOption);
			boost::thread th(boost::bind(&IUserContext::load_db, pWork));
			shared_ptr<CRecvDialog> pDlg(new CRecvDialog(pWork, &m_tab1));
			pDlg->Create(CRecvDialog::IDD);
			CRect r;
			pDlg->GetWindowRect(r);
			r.top += 18;
			r.left += 14;
			pDlg->MoveWindow(r);
			m_tab1.InsertItem(m_tab1.GetItemCount(), pCoinOption->prev_name.c_str());
			m_vlist.push_back(pDlg);
		}
		m_vlist[0]->ShowWindow(SW_SHOW);
	}

	
	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Example #14
0
int
newtail_main( int argc, char ** argv )
{
    char pidfile[80];

    sprintf( pidfile, PIDFILE, getenv( "HOME" ));

    if ( argc == 2 && strcmp( argv[1], "-q" ) == 0 )
    {
        unlink( pidfile );
        return 0;
    }

    num_tail_threads = 0;

    ThreadParams p;
    p.my_eid = 1;
    Threads th( &p );
    while ( argc > 1 )
    {
        (void) new NewTailThread( argv[1] );
        argc--;
        argv++;
    }

    newtail_die = false;
    (void) new MonitorThread( pidfile );
    th.loop();
    return 0;
}
Example #15
0
/** Submit a traceroute formatted as HTTP POST data to the server.
 */
bool ServerComm::submitTraceroute(const char *post_data, TrStatus *tstat, bool popupOnError) {
	bool submitted_ok = true;
	qDebug() << post_data;
	TrHttp th("trgen.ixmaps.ca", post_data, tstat);
	subm_waiting_completion = true;
	connect(&th, SIGNAL(done(bool)), this, SLOT(trResultsSubmitted(bool)));
	QTime dieTime = QTime::currentTime().addSecs(5);
	while( QTime::currentTime() < dieTime ) {
		QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
		if ( !subm_waiting_completion ) {
			break;
		}
	}
	if ( subm_waiting_completion ) {
		if ( popupOnError ) {
			QMessageBox::critical(owner, tr("Connection failure"),
			    tr("The connection to the central database is not working."),
			    QMessageBox::Ok);
		}
		tstat->setError(TrStatus::ERR_SUBMIT_TIMEOUT);
		submitted_ok = false;
	} else {
		//qDebug() << "TrHttp error " << th.error();
		QHttp::Error err = th.error();
		if ( err != QHttp::NoError ) {
			tstat->setError(msgConnFailure(err, popupOnError));
			submitted_ok = false;
		}
	}
	qDebug() << "posting, state " << th.state() << ", error " << th.error();
	qDebug() << "TID=" << tstat->traceroute_id << ", errorMsg=" << tstat->errorMsg;
	return submitted_ok;
}
jubeat_online::ImageSequenceResult jubeat_online::ImageSequence::LoadSequence(const char * filename){

	//***********************************************************************
	//関数名:LoadSeqeunce
	//説 明:独自形式の連続版画像の読み込み命令を発生させます
	//		 この関数が呼ばれるまでに、DxLib::SetUseASyncLoadFlag(TRUE)が
	//		 呼ばれている必要があります。呼ばない場合はこの関数内で
	//		 完全にロードが完了します。
	//戻り値:ImageSequenceResult型
	//***********************************************************************

	ImageSequenceResult ret = ImageSequenceResult::OK;

	//シーケンス画像ファイルのファイル名の処理
	if (filename != NULL) {
		ImageSequenceResult fret = SetSequenceFilename(filename);
		if(fret != ImageSequenceResult::OK) return fret;
	}

	else if (filename_ == NULL) return ImageSequenceResult::NULL_FILEPATH;		//ファイル名を指定しろ
	

	if (is_allocated_) DeleteSequence();
	
	OutputLogtext::OutputS("読み込みスレッドを開始します:" + static_cast<std::string>(filename),"ImageSequence");

	std::thread th(&jubeat_online::ImageSequence::LoadThread, this);
	th.detach();

	is_allocated_ = true;

	return ret;
}
Example #17
0
int main(int argc, char* argv[])
{
	try
	{
		unsigned short port = 12122;
		boost::asio::ip::address addr = boost::asio::ip::address::from_string("::1");

		server<> serv(port);
		client cli(std::cout, addr, port);

		std::cout << "Run server" << std::endl;
		boost::shared_ptr<boost::thread> th(new boost::thread([&serv] () { serv.run(); }));

		cli.run_test();

		// stop server
		std::raise(SIGINT);

		std::cout << "Stop server" << std::endl;

		th->join();
	}
	catch (std::exception& e)
	{
		std::cerr << "Exception: " << e.what() << std::endl;
	}

	return 0;
}
Example #18
0
    void compute_zenith_color()
    {
        float chi ((4.f/9.f - turbidity_/120.f) * (3.1415927f - 2.f * thetas_));

        // Zenith luminance in Kcd/m2
        zenith_color_.Y() = (4.0453f * turbidity_ - 4.9710f) * std::tan(chi) - 0.2155f * turbidity_ + 2.4192f;

        if (zenith_color_.Y() < 0.001f)
            zenith_color_.Y() = 0.001f;

        float t2(turbidity_ * turbidity_);
        //vector4<float> th (thetas_*thetas_*thetas_, thetas_*thetas_, thetas_, 1.f);
        vector4<float> th (0,0,0, 1.f);

        static const vector4<float> xcoef1 ( 0.00616f, -0.00375f,  0.00209f,  0.0f    ),
                                    xcoef2 (-0.02903f,  0.06377f, -0.03202f,  0.00394f),
                                    xcoef3 ( 0.11693f, -0.21196f,  0.06052f,  0.25886f),

                                    ycoef1 ( 0.00275f, -0.00610f,  0.00317f,  0.0f    ),
                                    ycoef2 (-0.04214f,  0.08970f, -0.04153f,  0.00516f),
                                    ycoef3 ( 0.15346f, -0.26756f,  0.06670f,  0.26688f);

        zenith_color_.x() = t2 * dot_prod(xcoef1, th) + turbidity_ * dot_prod(xcoef2, th) + dot_prod(xcoef3, th);
        zenith_color_.y() = t2 * dot_prod(ycoef1, th) + turbidity_ * dot_prod(ycoef2, th) + dot_prod(ycoef3, th);
    }
Example #19
0
void stress(misc::runner const & i_runner,
            host::program<decltype(prog)> i_program)
{
    host::context const& context = i_runner.m_context;
    host::queue & queue = i_runner.m_queue;

    host::buffer<pfm::int_> bufWrite(context, item_count);
    host::buffer<pfm::int_> bufDiff(context, item_count);
    queue(host::run_kernel(i_program, fill_index(bufWrite), item_count));
    queue(host::run_kernel(i_program, fill_index(bufDiff), item_count));

    for (int i = 0; i < 100; ++i) {
        std::thread th(
        [&] () {
            queue(host::run_kernel(i_program, add(bufWrite, bufDiff), item_count));
            queue(host::run_kernel(i_program, subtract(bufWrite, bufDiff), item_count));
        }
        );
        th.detach();
    }

    typedef decltype(bufWrite)::iterator iterator;
    for (int i = 0; i < 20; ++i) {
        auto future2 =
            queue(bufWrite.with_range(
        [](iterator i_begin, iterator i_end) {
            return std::accumulate(i_begin, i_end, 0);
        }));
        cl_int retval = future2.get();
        //std::cout << retval << std::endl;
        assert( retval %  (item_count * (item_count - 1) / 2) == 0);
    }
}
Example #20
0
	unsigned Process(uint64_t &processed)
	{
		int64_t staleTime;
		{
			int64_t k = m_kernelSession.LastTS();
			int64_t h = m_heapSession.LastTS();
			staleTime = max(k, h);
			staleTime = g_QPCHelper.GetQPCFrom(staleTime, -SESSION_CACHE_TIME_MS);
		}

		EventQueue::BlockList blk, blh;
		m_kernelSession.PopStales(staleTime, blk);
		m_heapSession.PopStales(staleTime, blh);

		EventQueue::BlockListTraver tk(&blk), th(&blh);

		while (!tk.end() && !th.end())
		{
			Event &ek = tk.elem();
			Event &eh = th.elem();
			if (ek.createtime() <= eh.createtime())
			{
				ek.inner()->consume();
				ek.inner()->destroy();
				tk.next();
			}
			else
			{
				eh.inner()->consume();
				eh.inner()->destroy();
				th.next();
			}
			++processed;
		}
		while (!tk.end())
		{
			Event &ek = tk.elem();
			ek.inner()->consume();
			ek.inner()->destroy();
			tk.next();
			++processed;
		}
		while (!th.end())
		{
			Event &eh = th.elem();
			eh.inner()->consume();
			eh.inner()->destroy();
			th.next();
			++processed;
		}

		m_lastTS = staleTime;

		if (!m_kernelSession.IsRunning())
			return m_kernelSession.ExitCode();
		if (!m_heapSession.IsRunning())
			return m_heapSession.ExitCode();
		return 0;
	}
Example #21
0
void ThreadRunner::start()
{
	boost::mutex::scoped_lock lock(m_boolmutex);
	if(m_looping) return;
	m_looping=true;
	boost::function0<void> run( boost::bind( &ThreadRunner::run , this ) );
	boost::thread th(run);
}
Example #22
0
void ThreadRunner::spawnSingleAction()
{
	boost::mutex::scoped_lock boollock(m_boolmutex);
	boost::mutex::scoped_lock calllock(m_callmutex);
	if(m_looping) return;
	boost::function0<void> call( boost::bind( &ThreadRunner::call , this ) );
	boost::thread th(call);
}
Example #23
0
int _tmain(int argc, _TCHAR* argv[])
{
    memory_pool* obj_pool = new memory_pool(1000, sizeof(obj));

    std::thread th(fun, obj_pool, 100);
    th.join();
    return 0;
}
Example #24
0
 void start()
 {
     for (unsigned int i = 0; i < _nbWorkers; ++i)
     {
         std::thread th(std::bind(&ThreadPool::launch, std::ref(*this)));
         th.detach();
     }
 }
Example #25
0
void testObj::test<3>(void)
{
  Thread th( (SyncThread(s_)) );
  usleep(100*1000);
  s_.start();
  for(int i=0; i<2; ++i)
    s_.waitForDone();
}
Example #26
0
/**
 * Fake async API, simulates an asynchronous process.
 * Starts a thread sleeping for 3secs then simulates an event calling handler
 */
void asyncApi(std::function<void(std::string)> handler) {
    std::cout << "called async in thread: " << std::this_thread::get_id() << "\n";
    std::thread th([handler]() {
        std::cout << "Started async, sleeping 3secs\n";
        std::this_thread::sleep_for(std::chrono::seconds(3));
        handler("Data from async");
    });
    th.detach();
}
				static void try_connect_frm(Fl_Widget* o, void* userdata) {
					
					auto ptr = ((ConnectWindowImpl*)userdata);
					std::string host = ptr->bInput->value();
					ptr->connectbtn->label("Connecting . . .");
					ptr->bInput->deactivate();
					ptr->connectbtn->deactivate();
					std::thread th([host, ptr]() { try_connect(host, ptr); });
					th.detach();
				}
Example #28
0
int main(int argc, char** argv)
{
  mephitis::bag_popper<sensor_msgs::PointCloud2> bagpopper(argv[1], argv[2], queue_pusher);
  boost::thread th(boost::ref(bagpopper));

  boost::thread consume(consumer);

  th.join();
  consume.join();
}
Example #29
0
vec4::ValueType
vec4::
lengthHom () const
{       
	vec3 th ( vec[ 0 ], vec[ 1 ], vec[ 2 ] );

	th /= vec[ 3 ];
	
	return th.length ();
}
Example #30
0
void
ClusterSet::read_from_file(const char * filename,
                           const map <string, const Record*> & uid_tree) {

    unsigned int count = 0;
    const unsigned int base = 100000;
    const unsigned int primary_delim_size = strlen(ClusterInfo::primary_delim);
    const unsigned int secondary_delim_size = strlen(ClusterInfo::secondary_delim);
    std::ifstream infile ( filename);

    if (infile.good()) {

        string filedata;
        while ( getline(infile, filedata)) {

            register size_t pos = 0, prev_pos = 0;
            pos = filedata.find(ClusterInfo::primary_delim, prev_pos);
            string keystring = filedata.substr( prev_pos, pos - prev_pos);
            const Record * key = retrieve_record_pointer_by_unique_id( keystring, uid_tree );
            prev_pos = pos + primary_delim_size;

            pos = filedata.find(ClusterInfo::primary_delim, prev_pos);
            double val = 0;
            if ( true ) {
                string cohesionstring = filedata.substr( prev_pos, pos - prev_pos);
                val = atof(cohesionstring.c_str());
            }
            prev_pos = pos + primary_delim_size;


            RecordPList tempv;
            while ( ( pos = filedata.find(ClusterInfo::secondary_delim, prev_pos) )!= string::npos){
                string valuestring = filedata.substr( prev_pos, pos - prev_pos);
                const Record * value = retrieve_record_pointer_by_unique_id( valuestring, uid_tree);
                tempv.push_back(value);
                prev_pos = pos + secondary_delim_size;
            }

            ClusterHead th(key, val);
            Cluster tempc(th, tempv);
            tempc.self_repair();
            this->consolidated.push_back(tempc);

            ++count;
            if ( count % base == 0 ) {
                std::cout << count << " records have been loaded from the cluster file. " << std::endl;
            }
        }
        std::cout << "Totally, " << count << " records have been loaded from " << filename << std::endl;
    }
    else {
        throw cException_File_Not_Found(filename);
    }
}