51 writePipe(INVALID_HANDLE_VALUE),
55 #if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600) 56 DuplicateHandle(GetCurrentProcess(), pipe, GetCurrentProcess(),
72 #if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600) 105 memset(&overl, 0,
sizeof overl);
106 overl.hEvent = CreateEvent(NULL,
TRUE,
FALSE, NULL);
124 const char *ptrData = copy.
data();
128 overl.OffsetHigh = 0;
129 while ((!
quitNow) && totalWritten < maxlen) {
131 if (!WriteFile(
writePipe, ptrData + totalWritten,
132 maxlen - totalWritten, &written, &overl)) {
134 if (GetLastError() == 0xE8) {
140 if (GetLastError() == ERROR_IO_PENDING) {
141 if (!GetOverlappedResult(
writePipe, &overl, &written,
TRUE)) {
142 CloseHandle(overl.hEvent);
146 CloseHandle(overl.hEvent);
153 totalWritten += written;
154 #if defined QPIPEWRITER_DEBUG 155 qDebug(
"QWindowsPipeWriter::run() wrote %d %d/%d bytes",
156 written,
int(totalWritten),
int(maxlen));
166 CloseHandle(overl.hEvent);
169 #endif //QT_NO_THREAD
qint64 write(const char *data, qint64 maxlen)
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
char * data()
Returns a pointer to the data stored in the byte array.
QByteArray & append(char c)
Appends the character ch to this byte array.
The QByteArray class provides an array of bytes.
The QObject class is the base class of all Qt objects.
static void msleep(unsigned long)
Forces the current thread to sleep for msecs milliseconds.
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QWindowsPipeWriter(HANDLE writePipe, QObject *parent=0)
#define FALSE
Synonym for false.
const T * ptr(const T &t)
void unlock()
Unlocks the mutex.
bool wait(QMutex *mutex, unsigned long time=ULONG_MAX)
#define TRUE
Synonym for true.
QWaitCondition waitCondition
void bytesWritten(qint64 bytes)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
bool wait(unsigned long time=ULONG_MAX)
Blocks the thread until either of these conditions is met:
int size() const
Returns the number of bytes in this byte array.
bool waitForWrite(int msecs)
void terminate()
Terminates the execution of the thread.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
void run()
The starting point for the thread.
The QThread class provides a platform-independent way to manage threads.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
bool isRunning() const
Returns true if the thread is running; otherwise returns false.
QByteArray & remove(int index, int len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
#define forever
This macro is provided for convenience for writing infinite loops.