当前位置: 首页>>代码示例>>C++>>正文


C++ wxMutex::TryLock方法代码示例

本文整理汇总了C++中wxMutex::TryLock方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMutex::TryLock方法的具体用法?C++ wxMutex::TryLock怎么用?C++ wxMutex::TryLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxMutex的用法示例。


在下文中一共展示了wxMutex::TryLock方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void  layprop::ViewProperties::lockLayer(word layno, bool lock) {
   // No error messages here, because of possible range use
   while (wxMUTEX_NO_ERROR != DBLock.TryLock());
   if (_drawprop._layset.end() != _drawprop._layset.find(layno))
      _drawprop._layset[layno]->_locked = lock;
   DBLock.Unlock();
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:7,代码来源:viewprop.cpp

示例2: lockDB

laydata::tdtdesign*  DataCenter::lockDB(bool checkACTcell) 
{
   if (_TEDDB) 
   {
      if (checkACTcell) _TEDDB->check_active();
      while (wxMUTEX_NO_ERROR != DBLock.TryLock());
      return _TEDDB;
   }
   else throw EXPTNactive_DB();
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:10,代码来源:datacenter.cpp

示例3: tmp_draw

void DataCenter::tmp_draw(const layprop::DrawProperties& drawprop,
                              TP base, TP newp) {
   if (_TEDDB) {
//      _TEDDB->check_active();
      while (wxMUTEX_NO_ERROR != DBLock.TryLock());
      _TEDDB->tmp_draw(drawprop, base, newp);
      DBLock.Unlock();
   }
// 
//   else throw EXPTNactive_DB();      
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:11,代码来源:datacenter.cpp

示例4: openGL_draw

void DataCenter::openGL_draw(layprop::DrawProperties& drawprop) {
// Maybe we need another try/catch in the layoutcanvas ?   
   if (_TEDDB) {
//      _TEDDB->check_active();
      while (wxMUTEX_NO_ERROR != DBLock.TryLock());
      _TEDDB->openGL_draw(drawprop);
      DBLock.Unlock();
   }
// 
//   else throw EXPTNactive_DB();      
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:11,代码来源:datacenter.cpp

示例5: while

//==============================================================================
void* console::parse_thread::Entry() {
//   wxLogMessage(_T("Mouse is %s (%ld, %ld)"), where.c_str(), x, y);
//   wxLogMessage(_T("Mutex try to lock..."));
   while (wxMUTEX_NO_ERROR != Mutex.TryLock());
//   wxLogMessage(_T("Mutex locked!"));
   telllloc.first_column = telllloc.first_line = 1;
   telllloc.last_column  = telllloc.last_line  = 1;
   telllloc.filename = NULL;
   void* b = tell_scan_string( command.c_str() );
   tellparse();
   my_delete_yy_buffer( b );
   Mutex.Unlock();
//   wxLogMessage(_T("Mutex unlocked"));
   return NULL;
};
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:16,代码来源:ted_prompt.cpp

示例6: lockGDS

GDSin::GDSFile* DataCenter::lockGDS(bool throwexception) 
{
   // Carefull HERE! When GDS is locked form the main thread
   // (GDS browser), then there is no catch pending -i.e.
   // throwing an exception will make the things worse
   // When it is locked from the parser command - then exception
   // is fine 
   if (_GDSDB) 
   {
      while (wxMUTEX_NO_ERROR != GDSLock.TryLock());
      return _GDSDB;
   }
   else {
      if (throwexception) throw EXPTNactive_GDS();
      else return NULL;
   }
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:17,代码来源:datacenter.cpp

示例7: Entry

wxThread::ExitCode AegisubVersionCheckerThread::Entry()
{
	if (!interactive)
	{
		// Automatic checking enabled?
		if (!OPT_GET("App/Auto/Check For Updates")->GetBool())
			return 0;

		// Is it actually time for a check?
		time_t next_check = OPT_GET("Version/Next Check")->GetInt();
		if (next_check > wxDateTime::GetTimeNow())
			return 0;
	}

	if (VersionCheckLock.TryLock() != wxMUTEX_NO_ERROR) return 0;

	try {
		DoCheck();
	}
	catch (const agi::Exception &e) {
		PostErrorEvent(wxString::Format(
			_("There was an error checking for updates to Aegisub:\n%s\n\nIf other applications can access the Internet fine, this is probably a temporary server problem on our end."),
			e.GetMessage()));
	}
	catch (...) {
		PostErrorEvent(_("An unknown error occurred while checking for updates to Aegisub."));
	}

	VersionCheckLock.Unlock();

	// While Options isn't perfectly thread safe, this should still be okay.
	// Traversing the std::map to find the key-value pair doesn't modify any data as long as
	// the key already exists (which it does at this point), and modifying the value only
	// touches that specific key-value pair and will never cause a rebalancing of the tree,
	// because the tree only depends on the keys.
	// Lastly, writing options to disk only happens when Options.Save() is called.
	time_t new_next_check_time = wxDateTime::GetTimeNow() + 60*60; // in one hour
	OPT_SET("Version/Next Check")->SetInt((int)new_next_check_time);

	return 0;
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:41,代码来源:dialog_version_check.cpp

示例8: GDSparse

void DataCenter::GDSparse(std::string filename, std::list<std::string>& topcells) 
{
   if (_GDSDB) 
   {
      std::string news = "Removing existing GDS data from memory...";
      tell_log(console::MT_WARNING,news);
      GDSclose();
   }
   while (wxMUTEX_NO_ERROR != GDSLock.TryLock());
   // parse the GDS file
   _GDSDB = new GDSin::GDSFile(filename.c_str());
   if (!_GDSDB->status()) return;
   // generate the hierarchy tree of cells
   _GDSDB->HierOut();
   // add GDS tab in the browser
   browsers::addGDStab();
   GDSin::GDSHierTree* root = _GDSDB->hierTree()->GetFirstRoot();
   do 
   {
      topcells.push_back(std::string(root->GetItem()->Get_StrName()));
   } while (NULL != (root = root->GetNextRoot()));
   unlockGDS();
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:23,代码来源:datacenter.cpp


注:本文中的wxMutex::TryLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。