#include "stdafx.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <WinSock2.h>
#include <memory>
#include <functional>
#include <iostream>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <atlconv.h>
#include <conio.h>
using namespace std;
#define PORT 5555
#define DATA_BUFFERSIZE 8192
//struct PER_IO_OPERATION_DATA : public OVERLAPPED
//{
// WSABUF DataBuf;
//};
DWORD WINAPI WorkItemFunc(PVOID pvContext)
{
int id = (int)pvContext;
cout << "线程id = " << GetCurrentThreadId() << ", value = " << (char)id << endl;
return 0;
}
#include <atlsafe.h>
void main()
{
char ch;
cout << "主线程id = " << GetCurrentThreadId() << endl;
while (1)
{
if(_kbhit())
{
ch = _getch();
if (ch == 0x1B)
{
break;
}
else
{
QueueUserWorkItem(&WorkItemFunc, (void*)ch, 0);
}
}
}
}