ReactOS  0.4.15-dev-2354-g9e947e2
WriterThread Struct Reference
Collaboration diagram for WriterThread:

Public Member Functions

 WriterThread (SOCKET sock, HANDLE hPipe)
 

Protected Member Functions

DWORD Run ()
 

Static Protected Member Functions

static DWORD WINAPI WriterThreadRoutine (LPVOID param)
 

Protected Attributes

SOCKET _sock
 
HANDLE _hPipe
 

Detailed Description

Definition at line 138 of file pipetunnel.cpp.

Constructor & Destructor Documentation

◆ WriterThread()

WriterThread::WriterThread ( SOCKET  sock,
HANDLE  hPipe 
)
inline

Definition at line 140 of file pipetunnel.cpp.

141  : _sock(sock),
142  _hPipe(hPipe)
143  {
144  DWORD tid;
145 
147 
148  if (hThread) {
150 
152  } else
153  delete this;
154  }
#define CloseHandle
Definition: compat.h:598
static DWORD WINAPI WriterThreadRoutine(LPVOID param)
Definition: pipetunnel.cpp:160
#define THREAD_PRIORITY_HIGHEST
Definition: winbase.h:274
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:699
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
Definition: tcpcore.h:1455
static TfClientId tid

Member Function Documentation

◆ Run()

DWORD WriterThread::Run ( void  )
inlineprotected

Definition at line 171 of file pipetunnel.cpp.

172  {
173  char buffer[1024];
174 
175  for(;;) {
176  int r = recv(_sock, buffer, sizeof(buffer), 0);
177 
178  if (r == -1) {
179  perror("recv()");
180  fprintf(stderr, "debugger connection broken\n");
181  _sock = (SOCKET)-1;
182  return 1;
183  }
184 
185  if (r) {
186  DWORD wrote;
187 
188  if (!WriteFile(_hPipe, buffer, r, &wrote, NULL))
189  break;
190 
191 #ifdef _DEBUG
192  dbg_trace('<', buffer, r);
193 #endif
194  }
195  }
196 
197  return 0;
198  }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
FILE * stderr
UINT_PTR SOCKET
Definition: winsock.h:47
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23

Referenced by WriterThreadRoutine().

◆ WriterThreadRoutine()

static DWORD WINAPI WriterThread::WriterThreadRoutine ( LPVOID  param)
inlinestaticprotected

Definition at line 160 of file pipetunnel.cpp.

161  {
162  WriterThread* pThis = (WriterThread*) param;
163 
164  DWORD ret = pThis->Run();
165 
166  delete pThis;
167 
168  return ret;
169  }
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret

Referenced by WriterThread().

Member Data Documentation

◆ _hPipe

HANDLE WriterThread::_hPipe
protected

Definition at line 158 of file pipetunnel.cpp.

Referenced by Run().

◆ _sock

SOCKET WriterThread::_sock
protected

Definition at line 157 of file pipetunnel.cpp.

Referenced by Run().


The documentation for this struct was generated from the following file: