aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2008-04-22 11:20:50 +0000
committerMarcus Brinkmann <[email protected]>2008-04-22 11:20:50 +0000
commita69c74e4effaf4565faf8714b0988b66777881c3 (patch)
treeaa11be2da53f6d4331133276d7fa50f4b645108d
parentdoc/ (diff)
downloadgpgme-a69c74e4effaf4565faf8714b0988b66777881c3.tar.gz
gpgme-a69c74e4effaf4565faf8714b0988b66777881c3.zip
2008-04-22 Marcus Brinkmann <[email protected]>
* w32-qt-io.cpp, kdpipeiodevice.cpp: New versions from Frank Osterfeld, implement blocking select.
Diffstat (limited to '')
-rw-r--r--gpgme/ChangeLog5
-rw-r--r--gpgme/kdpipeiodevice.cpp4
-rw-r--r--gpgme/w32-qt-io.cpp14
3 files changed, 14 insertions, 9 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index 35af33ad..219d4821 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-22 Marcus Brinkmann <[email protected]>
+
+ * w32-qt-io.cpp, kdpipeiodevice.cpp: New versions from Frank
+ Osterfeld, implement blocking select.
+
2008-03-11 Marcus Brinkmann <[email protected]>
* data.c (gpgme_data_read, gpgme_data_write): Retry on EINTR.
diff --git a/gpgme/kdpipeiodevice.cpp b/gpgme/kdpipeiodevice.cpp
index c4dd9f7c..5661790a 100644
--- a/gpgme/kdpipeiodevice.cpp
+++ b/gpgme/kdpipeiodevice.cpp
@@ -480,8 +480,8 @@ bool KDPipeIODevice::waitForReadyRead( int msecs ) { KDAB_CHECK_THIS;
LOCKED( r );
if ( r->bytesInBuffer() != 0 || r->eof || r->error )
return true;
- assert( false );
- return r->bufferNotEmptyCondition.wait( &r->mutex, msecs ) ;
+
+ return msecs >= 0 ? r->bufferNotEmptyCondition.wait( &r->mutex, msecs ) : r->bufferNotEmptyCondition.wait( &r->mutex );
}
template <typename T>
diff --git a/gpgme/w32-qt-io.cpp b/gpgme/w32-qt-io.cpp
index 9ccdff9a..264d729b 100644
--- a/gpgme/w32-qt-io.cpp
+++ b/gpgme/w32-qt-io.cpp
@@ -573,9 +573,6 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock);
- /* We only implement the special case of nonblock == true. */
- assert (nonblock);
-
int count = 0;
TRACE_SEQ (dbg_help, "select on [ ");
@@ -587,9 +584,12 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
}
else if (fds[i].for_read )
{
- const KDPipeIODevice * const chan = find_channel (fds[i].fd, 0);
- assert (chan);
- fds[i].signaled = chan->readWouldBlock() ? 0 : 1;
+ KDPipeIODevice * const chan = find_channel (fds[i].fd, 0);
+ assert (chan);
+ if ( nonblock )
+ fds[i].signaled = chan->readWouldBlock() ? 0 : 1;
+ else
+ fds[i].signaled = chan->waitForReadyRead( 1000 ) ? 1 : 0;
TRACE_ADD1 (dbg_help, "w0x%x ", fds[i].fd);
if ( fds[i].signaled )
count++;
@@ -598,7 +598,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
{
const KDPipeIODevice * const chan = find_channel (fds[i].fd, 0);
assert (chan);
- fds[i].signaled = chan->writeWouldBlock() ? 0 : 1;
+ fds[i].signaled = nonblock ? ( chan->writeWouldBlock() ? 0 : 1 ) : 1;
TRACE_ADD1 (dbg_help, "w0x%x ", fds[i].fd);
if ( fds[i].signaled )
count++;