| ︙ | | | ︙ | |
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
{0, 0, NULL, NULL, InitializeHostName, NULL, NULL};
/*
* Simple wrapper round the SendMessage syscall.
*/
#define SendSelectMessage(tsdPtr, message, payload) \
SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \
(WPARAM) (message), (LPARAM) (payload))
/*
* Address print debug functions
*/
#if 0
|
|
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
{0, 0, NULL, NULL, InitializeHostName, NULL, NULL};
/*
* Simple wrapper round the SendMessage syscall.
*/
#define SendSelectMessage(tsdPtr, message, payload) \
SendMessageW((tsdPtr)->hwnd, SOCKET_SELECT, \
(WPARAM) (message), (LPARAM) (payload))
/*
* Address print debug functions
*/
#if 0
|
| ︙ | | | ︙ | |
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
if (tsdPtr == NULL) {
return;
}
if (tsdPtr->socketThread != NULL) {
if (tsdPtr->hwnd != NULL) {
PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
/*
* Wait for the thread to exit. This ensures that we are
* completely cleaned up before we leave this function.
*/
WaitForSingleObject(tsdPtr->readyEvent, INFINITE);
|
|
|
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
if (tsdPtr == NULL) {
return;
}
if (tsdPtr->socketThread != NULL) {
if (tsdPtr->hwnd != NULL) {
PostMessageW(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
/*
* Wait for the thread to exit. This ensures that we are
* completely cleaned up before we leave this function.
*/
WaitForSingleObject(tsdPtr->readyEvent, INFINITE);
|
| ︙ | | | ︙ | |
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
|
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->pendingTcpState = NULL;
tsdPtr->socketList = NULL;
tsdPtr->hwnd = NULL;
tsdPtr->threadId = Tcl_GetCurrentThread();
tsdPtr->readyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (tsdPtr->readyEvent == NULL) {
goto initFailure;
}
tsdPtr->socketListLock = CreateEvent(NULL, FALSE, TRUE, NULL);
if (tsdPtr->socketListLock == NULL) {
goto initFailure;
}
tsdPtr->socketThread = CreateThread(NULL, 256, SocketThread, tsdPtr, 0,
&id);
if (tsdPtr->socketThread == NULL) {
goto initFailure;
|
|
|
|
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
|
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->pendingTcpState = NULL;
tsdPtr->socketList = NULL;
tsdPtr->hwnd = NULL;
tsdPtr->threadId = Tcl_GetCurrentThread();
tsdPtr->readyEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (tsdPtr->readyEvent == NULL) {
goto initFailure;
}
tsdPtr->socketListLock = CreateEventW(NULL, FALSE, TRUE, NULL);
if (tsdPtr->socketListLock == NULL) {
goto initFailure;
}
tsdPtr->socketThread = CreateThread(NULL, 256, SocketThread, tsdPtr, 0,
&id);
if (tsdPtr->socketThread == NULL) {
goto initFailure;
|
| ︙ | | | ︙ | |
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
|
if (tsdPtr->hwnd == NULL) {
return 1;
}
/*
* Process all messages on the socket window until WM_QUIT. This threads
* exits only when instructed to do so by the call to
* PostMessage(SOCKET_TERMINATE) in TclpFinalizeSockets().
*/
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
DispatchMessageW(&msg);
}
/*
|
|
|
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
|
if (tsdPtr->hwnd == NULL) {
return 1;
}
/*
* Process all messages on the socket window until WM_QUIT. This threads
* exits only when instructed to do so by the call to
* PostMessageW(SOCKET_TERMINATE) in TclpFinalizeSockets().
*/
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
DispatchMessageW(&msg);
}
/*
|
| ︙ | | | ︙ | |
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
|
TcpState *statePtr;
int info_found = 0;
TcpFdList *fds = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
#ifdef _WIN64
GetWindowLongPtrW(hwnd, GWLP_USERDATA);
#else
GetWindowLong(hwnd, GWL_USERDATA);
#endif
switch (message) {
default:
return DefWindowProcW(hwnd, message, wParam, lParam);
break;
case WM_CREATE:
/*
* Store the initial tsdPtr, it's from a different thread, so it's not
* directly accessible, but needed.
*/
#ifdef _WIN64
SetWindowLongPtr(hwnd, GWLP_USERDATA,
(LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams);
#else
SetWindowLong(hwnd, GWL_USERDATA,
(LONG) ((LPCREATESTRUCT)lParam)->lpCreateParams);
#endif
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
|
|
|
|
|
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
|
TcpState *statePtr;
int info_found = 0;
TcpFdList *fds = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
#ifdef _WIN64
GetWindowLongPtrW(hwnd, GWLP_USERDATA);
#else
GetWindowLongW(hwnd, GWL_USERDATA);
#endif
switch (message) {
default:
return DefWindowProcW(hwnd, message, wParam, lParam);
break;
case WM_CREATE:
/*
* Store the initial tsdPtr, it's from a different thread, so it's not
* directly accessible, but needed.
*/
#ifdef _WIN64
SetWindowLongPtrW(hwnd, GWLP_USERDATA,
(LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams);
#else
SetWindowLongW(hwnd, GWL_USERDATA,
(LONG) ((LPCREATESTRUCT)lParam)->lpCreateParams);
#endif
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
|
| ︙ | | | ︙ | |