本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
};
示例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;
}
}
示例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;
}
示例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();
}