Use CFSocket instead of CFFileDescriptor in wxCFEventLoopSource.

Use OS X socket APIs for monitoring file descriptors. They are more flexible
than CFFileDescriptor functions and can be used with any descriptors, not
necessarily the socket ones.

See #10258.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-07-03 00:29:05 +00:00
parent 71e9885be0
commit a25b76f5f9
3 changed files with 90 additions and 48 deletions

View File

@@ -42,23 +42,28 @@
#include "wx/nonownedwnd.h"
#endif
#include <CoreFoundation/CFSocket.h>
// ============================================================================
// wxCFEventLoopSource and wxCFEventLoop implementation
// ============================================================================
#if wxUSE_EVENTLOOP_SOURCE
void wxCFEventLoopSource::SetFileDescriptor(CFFileDescriptorRef cffd)
void wxCFEventLoopSource::InitSourceSocket(CFSocketRef cfSocket)
{
wxASSERT_MSG( !m_cffd, "shouldn't be called more than once" );
wxASSERT_MSG( !m_cfSocket, "shouldn't be called more than once" );
m_cffd = cffd;
m_cfSocket = cfSocket;
}
wxCFEventLoopSource::~wxCFEventLoopSource()
{
if ( m_cffd )
CFRelease(m_cffd);
if ( m_cfSocket )
{
CFSocketInvalidate(m_cfSocket);
CFRelease(m_cfSocket);
}
}
#endif // wxUSE_EVENTLOOP_SOURCE