本文整理汇总了C++中wxLogSysError函数的典型用法代码示例。如果您正苦于以下问题:C++ wxLogSysError函数的具体用法?C++ wxLogSysError怎么用?C++ wxLogSysError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxLogSysError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxCHECK_MSG
bool wxFFile::Seek(wxFileOffset ofs, wxSeekMode mode)
{
wxCHECK_MSG( IsOpened(), false, wxT("can't seek on closed file") );
int origin;
switch ( mode )
{
default:
wxFAIL_MSG(wxT("unknown seek mode"));
// still fall through
case wxFromStart:
origin = SEEK_SET;
break;
case wxFromCurrent:
origin = SEEK_CUR;
break;
case wxFromEnd:
origin = SEEK_END;
break;
}
#ifndef wxHAS_LARGE_FFILES
if ((long)ofs != ofs)
{
wxLogError(_("Seek error on file '%s' (large files not supported by stdio)"), m_name.c_str());
return false;
}
if ( wxFseek(m_fp, (long)ofs, origin) != 0 )
#else
if ( wxFseek(m_fp, ofs, origin) != 0 )
#endif
{
wxLogSysError(_("Seek error on file '%s'"), m_name.c_str());
return false;
}
return true;
}
示例2: GetEpollMask
bool wxEpollDispatcher::ModifyFD(int fd, wxFDIOHandler* handler, int flags)
{
epoll_event ev;
ev.events = GetEpollMask(flags, fd);
ev.data.ptr = handler;
const int ret = epoll_ctl(m_epollDescriptor, EPOLL_CTL_MOD, fd, &ev);
if ( ret != 0 )
{
wxLogSysError(_("Failed to modify descriptor %d in epoll descriptor %d"),
fd, m_epollDescriptor);
return false;
}
wxLogTrace(wxEpollDispatcher_Trace,
wxT("Modified fd %d (handler: %p) on epoll %d"), fd, handler, m_epollDescriptor);
return true;
}
示例3: GetEpollMask
bool wxEpollDispatcher::RegisterFD(int fd, wxFDIOHandler* handler, int flags)
{
epoll_event ev;
ev.events = GetEpollMask(flags, fd);
ev.data.ptr = handler;
const int ret = epoll_ctl(m_epollDescriptor, EPOLL_CTL_ADD, fd, &ev);
if ( ret != 0 )
{
wxLogSysError(_("Failed to add descriptor %d to epoll descriptor %d"),
fd, m_epollDescriptor);
return false;
}
wxLogTrace(wxEpollDispatcher_Trace,
_T("Added fd %d (handler %p) to epoll %d"), fd, handler, m_epollDescriptor);
return true;
}
示例4: wxCHECK_RET
void wxThreadInternal::Wait()
{
wxCHECK_RET( !m_isDetached, wxT("can't wait for a detached thread") );
// if the thread we're waiting for is waiting for the GUI mutex, we will
// deadlock so make sure we release it temporarily
if ( wxThread::IsMain() )
{
// give the thread we're waiting for chance to do the GUI call
// it might be in, we don't do this conditionally as the to be waited on
// thread might have to acquire the mutex later but before terminating
if ( wxGuiOwnedByMainThread() )
wxMutexGuiLeave();
}
{
wxCriticalSectionLocker lock(m_csJoinFlag);
if ( m_shouldBeJoined )
{
void *param1, *param2, *rc;
OSStatus err = MPWaitOnQueue(
m_notifyQueueId,
¶m1,
¶m2,
&rc,
kDurationForever );
if (err != noErr)
{
wxLogSysError( wxT( "Cannot wait for thread termination."));
rc = (void*) -1;
}
// actually param1 would be the address of m_exitcode
// but we don't need this here
m_exitcode = rc;
m_shouldBeJoined = false;
}
}
}
示例5: ReadEventsToBuf
int ReadEventsToBuf(char* buf, int size)
{
wxCHECK_MSG( IsOk(), false,
"Inotify not initialized or invalid inotify descriptor" );
memset(buf, 0, size);
ssize_t left = read(m_ifd, buf, size);
if (left == -1)
{
wxLogSysError(_("Unable to read from inotify descriptor"));
return -1;
}
else if (left == 0)
{
wxLogWarning(_("EOF while reading from inotify descriptor"));
return -1;
}
return left;
}
示例6: DoRemove
virtual bool DoRemove(wxSharedPtr<wxFSWatchEntryUnix> watch)
{
wxCHECK_MSG( IsOk(), false,
"Inotify not initialized or invalid inotify descriptor" );
int ret = DoRemoveInotify(watch.get());
if (ret == -1)
{
wxLogSysError( _("Unable to remove inotify watch") );
return false;
}
if (m_watchMap.erase(watch->GetWatchDescriptor()) != 1)
{
wxFAIL_MSG( wxString::Format("Path %s is not watched",
watch->GetPath()) );
}
watch->SetWatchDescriptor(-1);
return true;
}
示例7: wxLogSysError
bool wxThreadInternal::Resume()
{
ULONG ulrc = ::DosResumeThread(m_hThread);
if (ulrc != 0)
{
wxLogSysError(_("Can not resume thread %lu"), m_hThread);
return false;
}
// don't change the state from STATE_EXITED because it's special and means
// we are going to terminate without running any user code - if we did it,
// the codei n Delete() wouldn't work
if ( m_eState != STATE_EXITED )
{
m_eState = STATE_RUNNING;
}
return true;
}
示例8: DoPoll
int wxEpollDispatcher::Dispatch(int timeout)
{
epoll_event events[16];
const int rc = DoPoll(events, WXSIZEOF(events), timeout);
if ( rc == -1 )
{
wxLogSysError(_("Waiting for IO on epoll descriptor %d failed"),
m_epollDescriptor);
return -1;
}
int numEvents = 0;
for ( epoll_event *p = events; p < events + rc; p++ )
{
wxFDIOHandler * const handler = (wxFDIOHandler *)(p->data.ptr);
if ( !handler )
{
wxFAIL_MSG( wxT("NULL handler in epoll_event?") );
continue;
}
// note that for compatibility with wxSelectDispatcher we call
// OnReadWaiting() on EPOLLHUP as this is what epoll_wait() returns
// when the write end of a pipe is closed while with select() the
// remaining pipe end becomes ready for reading when this happens
if ( p->events & (EPOLLIN | EPOLLHUP) )
handler->OnReadWaiting();
else if ( p->events & EPOLLOUT )
handler->OnWriteWaiting();
else if ( p->events & EPOLLERR )
handler->OnExceptionWaiting();
else
continue;
numEvents++;
}
return numEvents;
}
示例9: wxASSERT
// get current file length
wxFileOffset wxFile::Length() const
{
wxASSERT( IsOpened() );
// we use a special method for Linux systems where files in sysfs (i.e.
// those under /sys typically) return length of 4096 bytes even when
// they're much smaller -- this is a problem as it results in errors later
// when we try reading 4KB from them
#ifdef __LINUX__
struct stat st;
if ( fstat(m_fd, &st) == 0 )
{
// returning 0 for the special files indicates to the caller that they
// are not seekable
return st.st_blocks ? st.st_size : 0;
}
//else: failed to stat, try the normal method
#endif // __LINUX__
wxFileOffset iRc = Tell();
if ( iRc != wxInvalidOffset ) {
wxFileOffset iLen = const_cast<wxFile *>(this)->SeekEnd();
if ( iLen != wxInvalidOffset ) {
// restore old position
if ( ((wxFile *)this)->Seek(iRc) == wxInvalidOffset ) {
// error
iLen = wxInvalidOffset;
}
}
iRc = iLen;
}
if ( iRc == wxInvalidOffset )
{
// last error was already set by Tell()
wxLogSysError(_("can't find length of file on file descriptor %d"), m_fd);
}
return iRc;
}
示例10: wxCHECK_MSG
wxMutexError wxMutexInternal::Lock(unsigned long ms)
{
wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") );
OSStatus err = MPEnterCriticalRegion( m_critRegion, ms );
switch ( err )
{
case noErr:
break;
case kMPTimeoutErr:
wxASSERT_MSG( ms != kDurationForever, wxT("unexpected timeout") );
return wxMUTEX_TIMEOUT;
default:
wxLogSysError(wxT("Could not lock mutex"));
return wxMUTEX_MISC_ERROR;
}
return wxMUTEX_NO_ERROR;
}
示例11: wxON_BLOCK_EXIT1
/* static */
THREAD_RETVAL wxThreadInternal::DoThreadStart(wxThread *thread)
{
wxON_BLOCK_EXIT1(DoThreadOnExit, thread);
THREAD_RETVAL rc = THREAD_ERROR_EXIT;
wxTRY
{
// store the thread object in the TLS
if ( !::TlsSetValue(gs_tlsThisThread, thread) )
{
wxLogSysError(_("Cannot start thread: error writing TLS."));
return THREAD_ERROR_EXIT;
}
rc = wxPtrToUInt(thread->Entry());
}
wxCATCH_ALL( wxTheApp->OnUnhandledException(); )
return rc;
示例12: Init
bool Init()
{
wxCHECK_MSG( !IsOk(), false,
"Kqueue appears to be already initialized" );
wxEventLoopBase *loop = wxEventLoopBase::GetActive();
wxCHECK_MSG( loop, false, "File system watcher needs an active loop" );
// create kqueue
m_kfd = kqueue();
if (m_kfd == -1)
{
wxLogSysError(_("Unable to create kqueue instance"));
return false;
}
// create source
m_source = loop->AddSourceForFD(m_kfd, m_handler, wxEVENT_SOURCE_INPUT);
return m_source != NULL;
}
示例13: wxLogSysError
wxThreadError wxThread::Kill()
{
if ( !IsRunning() )
return wxTHREAD_NOT_RUNNING;
// if ( !::TerminateThread(m_internal->GetHandle(), (DWORD)-1) )
{
wxLogSysError(_("Couldn't terminate thread"));
return wxTHREAD_MISC_ERROR;
}
m_internal->Free();
if ( IsDetached() )
{
delete this;
}
return wxTHREAD_NO_ERROR;
}
示例14: wxASSERT
bool wxThreadInternal::Suspend()
{
OSErr err ;
err = ::ThreadBeginCritical();
wxASSERT( err == noErr ) ;
if ( m_state != STATE_RUNNING )
{
err = ::ThreadEndCritical() ;
wxASSERT( err == noErr ) ;
wxLogSysError(_("Can not suspend thread %x"), m_tid);
return FALSE;
}
m_state = STATE_PAUSED;
err = ::SetThreadStateEndCritical(m_tid, kStoppedThreadState, kNoThreadID);
return TRUE;
}
示例15: fcntl
/* static */
void wxGUIEventLoop::InitBuffer()
{
// create DirectFB events buffer:
ms_buffer = wxIDirectFB::Get()->CreateEventBuffer();
// and setup a file descriptor that we can watch for new events:
ms_buffer->CreateFileDescriptor(&ms_bufferFd);
int flags = fcntl(ms_bufferFd, F_GETFL, 0);
if ( flags == -1 || fcntl(ms_bufferFd, F_SETFL, flags | O_NONBLOCK) == -1 )
{
wxLogSysError(_("Failed to switch DirectFB pipe to non-blocking mode"));
return;
}
wxFDIODispatcher *dispatcher = wxFDIODispatcher::Get();
wxCHECK_RET( dispatcher, "wxDFB requires wxFDIODispatcher" );
gs_DFBEventsHandler.SetFD(ms_bufferFd);
dispatcher->RegisterFD(ms_bufferFd, &gs_DFBEventsHandler, wxFDIO_INPUT);
}