本文整理汇总了C++中abort_callback::is_aborting方法的典型用法代码示例。如果您正苦于以下问题:C++ abort_callback::is_aborting方法的具体用法?C++ abort_callback::is_aborting怎么用?C++ abort_callback::is_aborting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类abort_callback
的用法示例。
在下文中一共展示了abort_callback::is_aborting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcquireByHandle
void CMutex::AcquireByHandle( HANDLE hMutex, abort_callback & aborter ) {
SetLastError(0);
HANDLE hWait[2] = {hMutex, aborter.get_abort_event()};
switch(WaitForMultipleObjects( 2, hWait, FALSE, INFINITE ) ) {
case WAIT_FAILED:
WIN32_OP_FAIL_CRITICAL("WaitForSingleObject");
case WAIT_OBJECT_0:
return;
case WAIT_OBJECT_0 + 1:
PFC_ASSERT( aborter.is_aborting() );
throw exception_aborted();
default:
uBugCheck();
}
}
示例2: createFile
HANDLE createFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile, abort_callback & abort) {
abort.check();
return CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
// CancelSynchronousIo() doesn't fucking work. Useless.
#if 0
pCancelSynchronousIo_t pCancelSynchronousIo = (pCancelSynchronousIo_t) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "CancelSynchronousIo");
if (pCancelSynchronousIo == NULL) {
#ifdef _DEBUG
uDebugLog() << "Async CreateFile unavailable - using regular";
#endif
return CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
} else {
#ifdef _DEBUG
uDebugLog() << "Starting async CreateFile...";
pfc::hires_timer t; t.start();
#endif
createFileData_t data = {lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile, NULL, 0};
HANDLE hThread = (HANDLE) _beginthreadex(NULL, 0, createFileProc, &data, 0, NULL);
HANDLE waitHandles[2] = {hThread, abort.get_abort_event()};
switch(WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE)) {
case WAIT_OBJECT_0: // succeeded
break;
case WAIT_OBJECT_0 + 1: // abort
#ifdef _DEBUG
uDebugLog() << "Aborting async CreateFile...";
#endif
pCancelSynchronousIo(hThread);
WaitForSingleObject(hThread, INFINITE);
break;
default:
uBugCheck();
}
CloseHandle(hThread);
SetLastError(data.dwErrorCode);
#ifdef _DEBUG
uDebugLog() << "Async CreateFile completed in " << pfc::format_time_ex(t.query(), 6) << ", status: " << (uint32_t) data.dwErrorCode;
#endif
if (abort.is_aborting()) {
if (data.hResult != INVALID_HANDLE_VALUE) CloseHandle(data.hResult);
throw exception_aborted();
}
return data.hResult;
}
#endif
}
示例3: track_indexer__g_get_tracks_wrap
static void track_indexer__g_get_tracks_wrap(const char * p_path,const service_ptr_t<file> & p_reader,const t_filestats & p_stats,playlist_loader_callback::t_entry_type p_type,playlist_loader_callback::ptr p_callback, abort_callback & p_abort) {
bool got_input = false;
bool fail = false;
try {
index_tracks_helper(p_path,p_reader,p_stats,p_type,p_callback,p_abort, got_input);
} catch(exception_aborted) {
throw;
} catch(exception_io_unsupported_format) {
fail = true;
} catch(std::exception const & e) {
fail = true;
console::formatter() << "could not enumerate tracks (" << e << ") on:\n" << file_path_display(p_path);
}
if (fail) {
if (!got_input && !p_abort.is_aborting()) {
if (p_type == playlist_loader_callback::entry_user_requested)
{
metadb_handle_ptr handle;
p_callback->handle_create(handle,make_playable_location(p_path,0));
p_callback->on_entry(handle,p_type,p_stats,true);
}
}
}
}
示例4: WaitForSingleObject
/** Does /not/ throw exception_io_data, unlike normal */
pfc::string8 SpotifySession::waitForLogin(abort_callback & p_abort) {
while (WAIT_OBJECT_0 != WaitForSingleObject(loggedInEvent, 200))
if (p_abort.is_aborting())
return "user aborted";
return loginResult;
}