当前位置: 首页>>代码示例>>C++>>正文


C++ ExitThread函数代码示例

本文整理汇总了C++中ExitThread函数的典型用法代码示例。如果您正苦于以下问题:C++ ExitThread函数的具体用法?C++ ExitThread怎么用?C++ ExitThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ExitThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: timer_thread_end

static void timer_thread_end(void)
{
  DIAGNOSTIC(2,"leaving timer thread",0,0);
  ExitThread(0);
}
开发者ID:Ravenbrook,项目名称:mlworks,代码行数:5,代码来源:native_threads.c

示例2: ExitThread

void *workThreadReceive( void *pObject )
#endif
{

#ifdef WIN32
    DWORD errorCode = 0;
#else
    int rv = 0;
#endif

    CPeakObj * pobj = ( CPeakObj *)pObject;
    if ( NULL == pobj ) {
#ifdef WIN32
        ExitThread( errorCode ); // Fail
#else
        pthread_exit( &rv );
#endif
    }

    PeakCanMsg peakMsg;

    while ( pobj->m_bRun ) {

        // Noting to do if we should end...
        if ( !pobj->m_bRun ) continue;

        LOCK_MUTEX( pobj->m_peakMutex );
        while ( 0 == ( pobj->m_procRead( &peakMsg ) & PEAK_CAN_ERR_QRCVEMPTY ) ) {

            // Check if this is a status message
            if ( PCAN_MSGTYPE_STATUS & peakMsg.msgType ) {

                continue; // TODO

            }

            // Write to the receive buffer
            if (  pobj->m_receiveList.nCount < PEAKDRV_MAX_RCVMSG ) {

                PCANALMSG pMsg	= new canalMsg;
                pMsg->flags = 0;

                if ( NULL != pMsg ) {

                    dllnode *pNode = new dllnode;
                    if ( NULL != pNode ) {

                        pMsg->timestamp = GetTickCount() * 1000;
                        pMsg->id = peakMsg.id;
                        pMsg->sizeData = peakMsg.len;
                        memcpy( pMsg->data, peakMsg.data, pMsg->sizeData );

                        // If extended set extended flag
                        if ( PCAN_MSGTYPE_EXTENDED & peakMsg.msgType ) {
                            pMsg->flags |= CANAL_IDFLAG_EXTENDED;
                        }

                        // Check for RTS package
                        if ( PCAN_MSGTYPE_RTR & peakMsg.msgType ) {
                            pMsg->flags |= CANAL_IDFLAG_RTR;
                        }

                        pNode->pObject = pMsg;
                        LOCK_MUTEX( pobj->m_receiveMutex );
                        dll_addNode( &pobj->m_receiveList, pNode );
                        UNLOCK_MUTEX( pobj->m_receiveMutex );

                        // Update statistics
                        pobj->m_stat.cntReceiveData += pMsg->sizeData;
                        pobj->m_stat.cntReceiveFrames += 1;

                    }
                    else {

                        delete pMsg;

                    }
                }
            }
            else {
                // Full buffer
                pobj->m_stat.cntOverruns++;
            }
        } // while rcv msg


        UNLOCK_MUTEX( pobj->m_peakMutex );
        SLEEP( 1 );

    } // while


#ifdef WIN32
    ExitThread( errorCode );
#else
    pthread_exit( &rv );
#endif

}
开发者ID:dinguluer,项目名称:vscp_software,代码行数:99,代码来源:peakobj.cpp

示例3: onThreadExit

void CALLBACK onThreadExit(ULONG_PTR dwParam)
{
	int err = onCleanSocket(threadStatus);
	ExitThread(err);
}
开发者ID:prasan5984,项目名称:JVMHeapScan,代码行数:5,代码来源:SocketOutputInterface.c

示例4: thread_error_exit

void thread_error_exit(const char *errmsg) 
{
    MessageBox (hwndDlg, errmsg, NULL, MB_OK);
    update_interface_state (NULL);
    ExitThread(0);
}
开发者ID:BGCX261,项目名称:zruijie4gzhu-svn-to-git,代码行数:6,代码来源:win_main.c

示例5: StreamLoop


//.........这里部分代码省略.........
						CopyMemory(lpBlockAdd1,lpSoundBuffer->leakBuff,lpSoundBuffer->leakSize);
						writeSize += lpSoundBuffer->leakSize;
						remainSize -= lpSoundBuffer->leakSize;
						lpSoundBuffer->leakSize = 0;
						my_deletes(lpSoundBuffer->leakBuff);
					}
					size = lpSoundBuffer->readFile->StreamReadFile(lpSoundBuffer->arcFileNum,lpSoundBuffer->streamNum,
						(char *)lpSoundBuffer->acmSrc.lpStream,lpSoundBuffer->acmSrc.dwStreamSize);
					if(size < lpSoundBuffer->acmSrc.dwStreamSize){	
						lpSoundBuffer->ash.cbSrcLength = lpSoundBuffer->ash.dwSrcUser = size;
						MMRESULT nError = acmStreamConvert(lpSoundBuffer->hAcm,&lpSoundBuffer->ash,0);
						lpSoundBuffer->ash.cbSrcLength = lpSoundBuffer->ash.dwSrcUser = lpSoundBuffer->acmSrc.dwStreamSize;
						if(1==lpSoundBuffer->repeat){	
							if(0==nError){
								if(remainSize >= lpSoundBuffer->ash.cbDstLengthUsed){
									CopyMemory(lpBlockAdd1+writeSize, lpSoundBuffer->acmDst.lpStream, lpSoundBuffer->ash.cbDstLengthUsed);
									writeSize  += lpSoundBuffer->ash.cbDstLengthUsed;
									remainSize -= lpSoundBuffer->ash.cbDstLengthUsed;
									ZeroMemory(lpBlockAdd1+writeSize, remainSize);
									if(blockSize2)ZeroMemory(lpBlockAdd2,blockSize2);
								}else{
									CopyMemory(lpBlockAdd1+writeSize, lpSoundBuffer->acmDst.lpStream, remainSize);
									CopyMemory(lpBlockAdd2, lpSoundBuffer->acmDst.lpStream +remainSize,lpSoundBuffer->ash.cbDstLengthUsed -remainSize);
									if(blockSize2 > lpSoundBuffer->ash.cbDstLengthUsed -remainSize){
										ZeroMemory(lpBlockAdd2 +(lpSoundBuffer->ash.cbDstLengthUsed -remainSize),blockSize2-(lpSoundBuffer->ash.cbDstLengthUsed -remainSize));
									}
								}
								lpSoundBuffer->repeat = 0;
								lpSoundBuffer->lpDSBuffer->Play(0,0,0);
							}
						}else{
							if(lpSoundBuffer->repeat) lpSoundBuffer->repeat --;
							lpSoundBuffer->readFile->StreamSeekFile(lpSoundBuffer->arcFileNum,lpSoundBuffer->streamNum,lpSoundBuffer->dataTopOffset,FILE_BEGIN);
							if(0==nError){
								while(remainSize>=lpSoundBuffer->ash.cbDstLengthUsed && remainSize>0){
									CopyMemory(lpBlockAdd1+writeSize,lpSoundBuffer->acmDst.lpStream,lpSoundBuffer->ash.cbDstLengthUsed);
									remainSize -= lpSoundBuffer->ash.cbDstLengthUsed;
									writeSize += lpSoundBuffer->ash.cbDstLengthUsed;
									if(remainSize > 0){
										size = lpSoundBuffer->readFile->StreamReadFile(lpSoundBuffer->arcFileNum,lpSoundBuffer->streamNum,
											(char *)lpSoundBuffer->acmSrc.lpStream,lpSoundBuffer->acmSrc.dwStreamSize);
										nError = acmStreamConvert(lpSoundBuffer->hAcm,&lpSoundBuffer->ash,ACM_STREAMCONVERTF_BLOCKALIGN);
									}
								}
								if(remainSize){
									CopyMemory(lpBlockAdd1+writeSize,lpSoundBuffer->acmDst.lpStream,remainSize);
									lpSoundBuffer->leakSize = lpSoundBuffer->ash.cbDstLengthUsed -remainSize;
									lpSoundBuffer->leakBuff = new BYTE[lpSoundBuffer->leakSize];
									CopyMemory(lpSoundBuffer->leakBuff,lpSoundBuffer->acmDst.lpStream +remainSize,lpSoundBuffer->leakSize);
								}
							}
						}
					}else{
						MMRESULT nError = acmStreamConvert(lpSoundBuffer->hAcm,&lpSoundBuffer->ash, ACM_STREAMCONVERTF_BLOCKALIGN);
						if(0==nError){
							while(remainSize>=lpSoundBuffer->ash.cbDstLengthUsed && remainSize>0){
								CopyMemory(lpBlockAdd1+writeSize,lpSoundBuffer->acmDst.lpStream,lpSoundBuffer->ash.cbDstLengthUsed);
								remainSize -= lpSoundBuffer->ash.cbDstLengthUsed;
								writeSize += lpSoundBuffer->ash.cbDstLengthUsed;
								if(remainSize > 0){
									size = lpSoundBuffer->readFile->StreamReadFile(lpSoundBuffer->arcFileNum,lpSoundBuffer->streamNum,
										(char *)lpSoundBuffer->acmSrc.lpStream,lpSoundBuffer->acmSrc.dwStreamSize);
									nError = acmStreamConvert(lpSoundBuffer->hAcm,&lpSoundBuffer->ash, ACM_STREAMCONVERTF_BLOCKALIGN);
								}
							}
							if(remainSize){
								CopyMemory(lpBlockAdd1+writeSize,lpSoundBuffer->acmDst.lpStream,remainSize);
								lpSoundBuffer->leakSize = lpSoundBuffer->ash.cbDstLengthUsed -remainSize;
								lpSoundBuffer->leakBuff = new BYTE[lpSoundBuffer->leakSize];
								CopyMemory(lpSoundBuffer->leakBuff,lpSoundBuffer->acmDst.lpStream +remainSize,lpSoundBuffer->leakSize);
							}
						}
					}
				}
				lpSoundBuffer->lpDSBuffer->Unlock(lpBlockAdd1, blockSize1, lpBlockAdd2, blockSize2);
			}
			break;
		  default:
SoundStop:
			lpSoundBuffer->repeat = 0;
			lpSoundBuffer->lpDSNotify->Release();
			lpSoundBuffer->lpDSNotify = NULL;
			CloseHandle(lpSoundBuffer->hEvent[0]);
			CloseHandle(lpSoundBuffer->hEvent[1]);
			CloseHandle(lpSoundBuffer->hEvent[2]);
			lpSoundBuffer->hEvent[0] = lpSoundBuffer->hEvent[1] = lpSoundBuffer->hEvent[2] = NULL;
			lpSoundBuffer->status = PCM_STOP;
			LeaveCriticalSection(&cr_section);
			DeleteCriticalSection(&cr_section);
			CloseHandle(lpSoundBuffer->hLoopThread);
			lpSoundBuffer->hLoopThread = NULL;
			ExitThread(TRUE);
			return 0L;
		}
		LeaveCriticalSection(&cr_section);
	}
	DeleteCriticalSection(&cr_section);
	ExitThread(TRUE);
	return 0L;
} // StreamLoop
开发者ID:autch,项目名称:aquaplus_gpl,代码行数:101,代码来源:soundDS.cpp

示例6: smartcard_thread_func


//.........这里部分代码省略.........
						WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
						goto out;
					}

					if (status == WAIT_TIMEOUT)
						break;

					irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue);

					if (irp)
					{
						if (irp->thread)
						{
							status = WaitForSingleObject(irp->thread, INFINITE);

							if (status == WAIT_FAILED)
							{
								error = GetLastError();
								WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
								goto out;
							}

							CloseHandle(irp->thread);
							irp->thread = NULL;
						}

						if ((error = smartcard_complete_irp(smartcard, irp)))
						{
							WLog_ERR(TAG, "smartcard_complete_irp failed with error %lu!", error);
							goto out;
						}
					}
				}

				break;
			}

			irp = (IRP*) message.wParam;

			if (irp)
			{
				if ((error = smartcard_process_irp(smartcard, irp)))
				{
					WLog_ERR(TAG, "smartcard_process_irp failed with error %lu!", error);
					goto out;
				}
			}
		}

		status = WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0);

		if (status == WAIT_FAILED)
		{
			error = GetLastError();
			WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
			break;
		}

		if (status == WAIT_OBJECT_0)
		{

			irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue);

			if (irp)
			{
				if (irp->thread)
				{
					status = WaitForSingleObject(irp->thread, INFINITE);

					if (status == WAIT_FAILED)
					{
						error = GetLastError();
						WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
						break;
					}

					CloseHandle(irp->thread);
					irp->thread = NULL;
				}

				if ((error = smartcard_complete_irp(smartcard, irp)))
				{
					if (error == CHANNEL_RC_NOT_CONNECTED)
					{
						error = CHANNEL_RC_OK;
						goto out;
					}
					WLog_ERR(TAG, "smartcard_complete_irp failed with error %lu!", error);
					goto out;
				}
			}
		}
	}
out:
	if (error && smartcard->rdpcontext)
		setChannelError(smartcard->rdpcontext, error, "smartcard_thread_func reported an error");

	ExitThread((DWORD)error);
	return NULL;
}
开发者ID:speidy,项目名称:FreeRDP,代码行数:101,代码来源:smartcard_main.c

示例7: ExitThread

void Thread::quit()
{
	mImpl->state = ThreadImpl::Stopped;
	ExitThread(0);
}
开发者ID:rudysnow,项目名称:SimbiconPlatform,代码行数:5,代码来源:PsWindowsThread.cpp

示例8: cliprdr_server_thread

static void* cliprdr_server_thread(void* arg)
{
	DWORD status;
	DWORD nCount;
	HANDLE events[8];
	HANDLE ChannelEvent;
	CliprdrServerContext* context = (CliprdrServerContext*) arg;
	CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
	UINT error;

	ChannelEvent = context->GetEventHandle(context);

	nCount = 0;
	events[nCount++] = cliprdr->StopEvent;
	events[nCount++] = ChannelEvent;

	if ((error = cliprdr_server_init(context)))
	{
		WLog_ERR(TAG, "cliprdr_server_init failed with error %lu!", error);
		goto out;
	}

	while (1)
	{
		status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);

		if (status == WAIT_FAILED)
		{
            error = GetLastError();
            WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
            goto out;
		}

        status = WaitForSingleObject(cliprdr->StopEvent, 0);

        if (status == WAIT_FAILED)
        {
            error = GetLastError();
            WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
            goto out;
        }

		if (status == WAIT_OBJECT_0)
			break;

        status = WaitForSingleObject(ChannelEvent, 0);

        if (status == WAIT_FAILED)
        {
            error = GetLastError();
            WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
            goto out;
        }

		if (status == WAIT_OBJECT_0)
		{
			if ((error = context->CheckEventHandle(context)))
			{
				WLog_ERR(TAG, "CheckEventHandle failed with error %lu!", error);
				break;
			}
		}
	}
out:
	if (error && context->rdpcontext)
		setChannelError(context->rdpcontext, error, "cliprdr_server_thread reported an error");

	ExitThread((DWORD)error);
	return NULL;
}
开发者ID:BUGgs,项目名称:FreeRDP,代码行数:70,代码来源:cliprdr_main.c

示例9: entry

void entry(){
	//MessageBoxA(0, "I'm payload", "test", 0);
	ExitThread(0);
}
开发者ID:0x37N0w4N,项目名称:malware,代码行数:4,代码来源:main.cpp

示例10: memset


//.........这里部分代码省略.........
				memset(buf, 0, sizeof(buf));

				ReadFile(m_hRead, buf, BUFSIZE, &m_bread, NULL);
				printf("%s", buf);
				if(!game.getTurn())
					parseAIMove(buf);

				Sleep(100);

				PeekNamedPipe(m_hRead, buf, BUFSIZE, &m_bread, &m_avail, NULL);
				if(m_bread > 0)
					continue;
				else
					break;
			}
		}

		if(m_engine == ENGINE_STOCKFISH){
			//sprintf(buf, (i == 0) ? "uci " : (i == 1) ? "isready " : (i == 2) ? "" : (i == 3) ? "" : "");
			sprintf(buf, (i == 0) ? "uci " : "");
		}
		else{
			sprintf(buf, (i == 0) ? "uci " : (i == 1) ? "isready " : (i == 2) ? "setoption name Hash value 512 " : (i == 3) ? "setoption name UCI_LimitStrength value true " : "");
		}
		if(m_sendMove == true){
			strcat(m_pos, m_lastUserMove);
			strcat(m_pos, " ");

			WriteFile(m_hWrite, m_pos, sizeof(m_pos), &m_bread, NULL);
			WriteFile(m_hWrite, "\n", 1, &m_bread, NULL);

			//sprintf(buf, "go wtime %ld btime %ld depth %d ", g_whiteTime, g_blackTime, m_searchDepth);
			while(game.isAnimating())
				Sleep(50);

			// calculate depth to search
			if(m_engine != ENGINE_STOCKFISH){
				if(aiLevel != game.getAILevel()){
					aiLevel = game.getAILevel();
					switch(aiLevel){
					case Game::CHILD:
						depth = 1;
						sprintf(buf, "setoption name UCI_Elo value 1000 "); // it's questionable whether or not this works
						break;

					case Game::WALRUS:
						depth = 3;
						sprintf(buf, "setoption name UCI_Elo value 1200 ");
						break;

					case Game::LION:
					default:
						depth = 5;
						sprintf(buf, "setoption name UCI_Elo value 1500 ");
						break;

					case Game::RAPTOR:
						depth = 10;
						sprintf(buf, "setoption name UCI_Elo value 1800 ");
						break;

					case Game::GRANDMASTER:
						depth = 15;
						sprintf(buf, "setoption name UCI_Elo value 2900 ");
						break;
					}

					WriteFile(m_hWrite, buf, sizeof(buf), &m_bread, NULL);
					WriteFile(m_hWrite, "\n", 1, &m_bread, NULL);
				}
			}

			//sprintf(buf, "go wtime %ld btime %ld ", game.getTime(WHITE), game.getTime(BLACK));
			sprintf(buf, "go wtime %ld btime %ld depth %d ", game.getTime(WHITE), game.getTime(BLACK), depth);
			WriteFile(m_hWrite, buf, sizeof(buf), &m_bread, NULL);
			WriteFile(m_hWrite, "\n", 1, &m_bread, NULL);

			//printf("NEW POS: [%s]\n", m_pos);

			m_sendMove = false;
			game.setTurn(BLACK);
		}
		else{
			WriteFile(m_hWrite, buf, sizeof(buf), &m_bread, NULL);
			WriteFile(m_hWrite, "\n", 1, &m_bread, NULL);

			if(i > 100000)
				i = 6;
		}

		Sleep(500);
		
		//if(game.getTurn() == WHITE)
			//;///printf("Waiting for user to move...\n");
	}

	cleanup();

	ExitThread(0);
}
开发者ID:ddugovic,项目名称:etherealchess,代码行数:101,代码来源:ai.cpp

示例11: SplashThread


//.........这里部分代码省略.........
				splashWithMarkers = false;
				break;
			}
		}
		int splashHeight = SplashBmp->getHeight();
		for (i = 0; splashWithMarkers && (i < splashHeight); ++i)
			if(SplashBmp->getRow(i)[0] & 0xFF000000)
			{
				if (y < 0)
				{
					y = i-1; // 1 pixel for marker line
					splashWithMarkers = true;
				} else
				{
					y = -1;
					splashWithMarkers = false;
					break;
				}
			}

			TCHAR verString[256] = {0};
			TCHAR* mirandaVerString = mir_a2t(szVersion);
			mir_sntprintf(verString, SIZEOF(verString), _T("%s%s"), szPrefix, mirandaVerString);
			mir_free(mirandaVerString);
			LOGFONT lf = {0};
			lf.lfHeight = 14;
			_tcscpy_s(lf.lfFaceName, _T("Verdana"));
			SelectObject(SplashBmp->getDC(), CreateFontIndirect(&lf));
			if (!splashWithMarkers)
			{
				SIZE v_sz = {0,0};
				GetTextExtentPoint32(SplashBmp->getDC(), verString, (int)_tcslen(verString), &v_sz);
				x = SplashBmp->getWidth()/2-(v_sz.cx/2);
				y = SplashBmp->getHeight()-(SplashBmp->getHeight()*(100-90)/100);
			}

			SetTextColor(SplashBmp->getDC(), (0xFFFFFFFFUL-SplashBmp->getRow(y)[x])&0x00FFFFFFUL);
			//SplashBmp->DrawText(verString,SplashBmp->getWidth()/2-(v_sz.cx/2),SplashBmp->getHeight()-30);	 
			SetBkMode(SplashBmp->getDC(), TRANSPARENT);
			SplashBmp->DrawText(verString, x, y);
			//free (ptr_verString);
	}

	SetWindowLongPtr(hwndSplash, GWL_EXSTYLE, GetWindowLongPtr(hwndSplash, GWL_EXSTYLE) | WS_EX_LAYERED);
	UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);

	ShowWindow(hwndSplash, SW_SHOWNORMAL);

	if (options.fadein)
	{
		// Fade in
		int i;
		for (i = 0; i < 255; i += options.fisteps)
		{
			blend.SourceConstantAlpha = i;
			UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
			Sleep(1);
		}
	}
	blend.SourceConstantAlpha = 255;
	UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);

	if (DWORD(arg) > 0)
	{
		if (SetTimer(hwndSplash, 6, DWORD(arg), 0))
		{
			#ifdef _DEBUG
				logMessage(_T("Timer TimeToShow"), _T("set"));
			#endif
		}
	}
	else
		if (bmodulesloaded)
		{
			if (SetTimer(hwndSplash, 8, 2000, 0))
			{
				#ifdef _DEBUG
					logMessage(_T("Timer Modules loaded"), _T("set"));
				#endif
			}
		}

	// The Message Pump
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0) == TRUE) //NULL means every window in the thread; == TRUE means a safe pump.
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	if (options.playsnd)
	{
		pControl->Release();
		pGraph->Release();
		CoUninitialize();
	}

	ExitThread(0);
	return 1;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:splash.cpp

示例12: MyWndThread2

DWORD WINAPI MyWndThread2(LPVOID lpParameter)
{
    MSG msg;
    HANDLE hMemory;
    PWNDCLASS pWndClass;
    BOOL bSuccess;
    CHAR lpBuffer[128];
    HANDLE myEvent = *((HANDLE *)lpParameter);
    RECT windowRect;

    hMemory = LocalAlloc(LPTR, sizeof(WNDCLASS));
    if(!hMemory){
	return(FALSE);
    }

    pWndClass = (PWNDCLASS) LocalLock(hMemory);
    pWndClass->hCursor = LoadCursor(NULL, IDC_ARROW);
    pWndClass->hIcon = LoadIcon(NULL, IDI_APPLICATION);
    pWndClass->lpszMenuName = NULL;
    pWndClass->lpszClassName = (LPSTR) "ECE291Socket";
    pWndClass->hbrBackground = NULL;//GetStockObject(WHITE_BRUSH);
    pWndClass->hInstance = GetInstance();
    pWndClass->style = 0;
    pWndClass->lpfnWndProc = (WNDPROC)MyWndProc2;

    bSuccess = RegisterClass(pWndClass);

    LocalUnlock(hMemory);
    LocalFree(hMemory);

    hWnd = CreateWindowEx(0,
	"ECE291Socket",
	"ECE 291 Sockets Handler",
	WS_ICONIC,
	CW_USEDEFAULT,
	CW_USEDEFAULT,
	CW_USEDEFAULT,
	CW_USEDEFAULT,
	NULL,
	NULL,
	GetInstance(),
	NULL);

    if (!hWnd)
	return FALSE;

    SetEvent(myEvent);

    for(;;) {
	if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
	    TranslateMessage(&msg);
	    DispatchMessage(&msg);
	    if (msg.message == WM_CLOSE)
		break;
	}
    }

    DestroyWindow(hWnd);
    UnregisterClass("ECE291Socket", GetInstance());

    SetEvent(myEvent);

    ExitThread(0);
}
开发者ID:ece291,项目名称:ex291,代码行数:64,代码来源:mywindow2.c

示例13: drdynvc_virtual_channel_client_thread

static DWORD WINAPI drdynvc_virtual_channel_client_thread(LPVOID arg)
{
	wStream* data;
	wMessage message;
	UINT error = CHANNEL_RC_OK;
	drdynvcPlugin* drdynvc = (drdynvcPlugin*) arg;

	if (!drdynvc)
	{
		ExitThread((DWORD) CHANNEL_RC_BAD_CHANNEL_HANDLE);
		return CHANNEL_RC_BAD_CHANNEL_HANDLE;
	}

	while (1)
	{
		if (!MessageQueue_Wait(drdynvc->queue))
		{
			WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_Wait failed!");
			error = ERROR_INTERNAL_ERROR;
			break;
		}

		if (!MessageQueue_Peek(drdynvc->queue, &message, TRUE))
		{
			WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_Peek failed!");
			error = ERROR_INTERNAL_ERROR;
			break;
		}

		if (message.id == WMQ_QUIT)
			break;

		if (message.id == 0)
		{
			data = (wStream*) message.wParam;

			if ((error = drdynvc_order_recv(drdynvc, data)))
			{
				Stream_Free(data, TRUE);
				WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_order_recv failed with error %"PRIu32"!", error);
				break;
			}

			Stream_Free(data, TRUE);
		}
	}

	{
		/* Disconnect remaining dynamic channels that the server did not.
		* This is required to properly shut down channels by calling the appropriate
		* event handlers. */
		DVCMAN* drdynvcMgr = (DVCMAN*)drdynvc->channel_mgr;

		while (ArrayList_Count(drdynvcMgr->channels) > 0)
		{
			IWTSVirtualChannel* channel = (IWTSVirtualChannel*)
			                              ArrayList_GetItem(drdynvcMgr->channels, 0);
			const UINT32 ChannelId = drdynvc->channel_mgr->GetChannelId(channel);
			dvcman_close_channel(drdynvc->channel_mgr, ChannelId);
		}
	}

	if (error && drdynvc->rdpcontext)
		setChannelError(drdynvc->rdpcontext, error,
		                "drdynvc_virtual_channel_client_thread reported an error");

	ExitThread((DWORD) error);
	return error;
}
开发者ID:Devolutions,项目名称:FreeRDP,代码行数:69,代码来源:drdynvc_main.c

示例14: tMPI_Thread_exit

void tMPI_Thread_exit(void *value_ptr)
{
    /* TODO: fix exit code */
    /* TODO: call destructors for thread-local storage */
    ExitThread( 0 );
}
开发者ID:BradleyDickson,项目名称:ABPenabledGROMACS,代码行数:6,代码来源:winthreads.c

示例15: _endthread

void _endthread(void) {
    ExitThread(0);
}
开发者ID:djs55,项目名称:stunnel,代码行数:3,代码来源:sthreads.c


注:本文中的ExitThread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。