本文整理汇总了C++中Reply函数的典型用法代码示例。如果您正苦于以下问题:C++ Reply函数的具体用法?C++ Reply怎么用?C++ Reply使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRequest
DWORD
CPullPin::ThreadProc(void)
{
for (;;) {
DWORD cmd = GetRequest();
switch(cmd) {
case TM_Exit:
Reply(S_OK);
return 0;
case TM_Pause:
// we are paused already
Reply(S_OK);
break;
case TM_Start:
Reply(S_OK);
Process();
break;
}
// at this point, there should be no outstanding requests on the
// upstream filter.
// We should force begin/endflush to ensure that this is true.
// !!!Note that we may currently be inside a BeginFlush/EndFlush pair
// on another thread, but the premature EndFlush will do no harm now
// that we are idle.
m_pReader->BeginFlush();
CleanupCancelled();
m_pReader->EndFlush();
}
}
示例2: while
//CAMThread Stuff
DWORD OggDemuxFilter::ThreadProc()
{
while(true)
{
DWORD locThreadCommand = GetRequest();
switch(locThreadCommand)
{
case THREAD_EXIT:
Reply(S_OK);
LOG(logDEBUG) << __FUNCTIONW__ << " THREAD IS EXITING";
return S_OK;
case THREAD_RUN:
Reply(S_OK);
DataProcessLoop();
LOG(logDEBUG) << __FUNCTIONW__ << " Data Process Loop has returned";
break;
case THREAD_SEEK:
m_oggBuffer.clearData();
SetCurrentReaderPos(GetRequestedSeekPos());
Reply(S_OK);
DataProcessLoop();
LOG(logDEBUG) << __FUNCTIONW__ << " Seek request";
break;
}
}
return S_OK;
}
示例3: bwprintf
static
VOID
RpspServerHandleOnePlayerQuitting
(
IN INT quittingPlayer,
IN INT otherPlayer
)
{
RPS_SERVER_REQUEST otherPlayerRequest;
RPS_SERVER_RESPONSE otherPlayerResponse = PartnerQuitResponse;
bwprintf(BWCOM2, "Server: Client %d is quitting \r\n", quittingPlayer);
// Acknowledge quitting player, and inform other player
Reply(quittingPlayer, NULL, 0);
Reply(otherPlayer, &otherPlayerResponse, sizeof(otherPlayerResponse));
// Wait for other player to quit
Receive(&otherPlayer, &otherPlayerRequest, sizeof(otherPlayerRequest));
ASSERT(QuitRequest == otherPlayerRequest.type);
bwprintf(BWCOM2, "Server: Client %d is quitting \r\n", otherPlayer);
// Acknowledge player 2 quitting
Reply(otherPlayer, NULL, 0);
}
示例4: nameserv
void nameserv () {
char msg[6];
int tid;
int ans;
struct name reg[100];
int num = 0;
while (1) {
DPRINT("(()) Nameserver begining of loop...\r\n");
Receive (&tid, msg, 6);
DPRINT("received from tid %d, message(0x%x) \'%s\'\r\n", tid, msg, msg);
switch (msg[0]) {
case 'w':
ans = lookup ((msg+1), reg, num);
// bwprintf (COM2, "Nameserv:lookup gave %d.\r\n", ans);
Reply(tid, (char*)&ans, 4);
// bwprintf (COM2, "Nameserv: Reply sucessfull.\r\n");
break;
case 'r':
DPRINT("NAMES: registering %s to tid %d.\r\n", msg + 1, tid);
strcpy (reg[num].name, msg + 1);
reg[num++].tid = tid;
Reply (tid, 0, 0);
// bwprintf (COM2, "Nameserv: Reply sucessfull.\r\n");
break;
default:
Reply (tid, 0, 0);
break;
}
}
}
示例5: GetCurrentThreadId
DWORD CAVISplitter::ThreadProc()
{
m_threadid = GetCurrentThreadId();
while (1)
{
DWORD cmd = GetRequest();
switch (cmd)
{
case tm_exit:
stopPinsProcessingThreads();
Reply(S_OK);
return 0;
case tm_pause:
// we are paused already
stopPinsProcessingThreads();
Reply(S_OK);
break;
case tm_start:
startPinsProcessingThreads();
Reply(S_OK);
break;
}
}
return 0;
}
示例6: DebugLog
DWORD CWavPackDSSplitterInputPin::ThreadProc()
{
Command com;
DebugLog("===> Entering CWavPackDSSplitterInputPin::ThreadProc... 0x%08X", GetCurrentThreadId());
do
{
DebugLog("===> ThreadProc waiting command... 0x%08X", GetCurrentThreadId());
com = (Command)GetRequest();
switch (com)
{
case CMD_EXIT:
DebugLog("===> ThreadProc CMD_EXIT 0x%08X", GetCurrentThreadId());
Reply(NOERROR);
break;
case CMD_STOP:
DebugLog("===> ThreadProc CMD_STOP 0x%08X", GetCurrentThreadId());
Reply(NOERROR);
break;
case CMD_RUN:
DebugLog("===> ThreadProc CMD_RUN 0x%08X", GetCurrentThreadId());
DebugLog("===> Entering DoProcessingLoop... 0x%08X", GetCurrentThreadId());
DoProcessingLoop();
DebugLog("<=== Leaving DoProcessingLoop 0x%08X", GetCurrentThreadId());
break;
}
} while (com != CMD_EXIT);
DebugLog("<=== Leaving CWavPackDSSplitterInputPin::ThreadProc 0x%08X", GetCurrentThreadId());
return NOERROR;
}
示例7: SendServerList
void SendServerList( int Sock )
{
FILE *fp;
char buf[250], writebuf[256];
int len;
fp = fopen(FileName, "r");
if (fp == NULL) {
Reply(Sock, 410, "No service right now. Please try again later");
return;
}
while (!feof(fp)) {
memset(buf, 0, 250);
fgets(buf, 249, fp);
stripcrlf(buf);
if (buf[0] == '#')
continue;
if (strlen(buf) < 10)
continue;
sprintf(writebuf, "210-%s\r\n", buf);
len = strlen(writebuf);
if (len < 3)
continue;
if (write( Sock, writebuf, len ) != len)
{
syslog(LOG_ERR, "write() failed");
return;
}
}
Reply(Sock, 210, " ");
sleep(1);
}
示例8: CmdChessHelp
void
CmdChessHelp(CORE_DATA *cd)
{
Reply("This is a Player-vs-Player Chess bot");
Reply("It is in testing and doesn't support the following:");
Reply("- En Passant");
Reply("- Underpromotions");
}
示例9: SwitchpTask
static
VOID
SwitchpTask()
{
SWITCH_DIRECTION directions[NUM_SWITCHES];
VERIFY(SUCCESSFUL(RegisterAs(SWITCH_SERVER_NAME)));
IO_DEVICE com1;
VERIFY(SUCCESSFUL(Open(UartDevice, ChannelCom1, &com1)));
for (UINT i = 0; i < NUM_SWITCHES; i++)
{
UCHAR sw = SwitchpFromIndex(i);
VERIFY(SUCCESSFUL(SwitchpDirection(&com1, sw, SwitchCurved)));
directions[i] = SwitchCurved;
ShowSwitchDirection(i, sw, SwitchCurved);
}
VERIFY(SUCCESSFUL(SwitchpDisableSolenoid(&com1)));
while (1)
{
INT senderId;
SWITCH_REQUEST request;
VERIFY(SUCCESSFUL(Receive(&senderId, &request, sizeof(request))));
switch(request.type)
{
case SetDirectionRequest:
{
VERIFY(SUCCESSFUL(SwitchpDirection(&com1, request.sw, request.direction)));
VERIFY(SUCCESSFUL(SwitchpDisableSolenoid(&com1)));
UINT switchIndex = SwitchpToIndex(request.sw);
directions[switchIndex] = request.direction;
VERIFY(SUCCESSFUL(Reply(senderId, NULL, 0)));
ShowSwitchDirection(switchIndex, request.sw, request.direction);
break;
}
case GetDirectionRequest:
{
UINT switchIndex = SwitchpToIndex(request.sw);
SWITCH_DIRECTION direction = directions[switchIndex];
VERIFY(SUCCESSFUL(Reply(senderId, &direction, sizeof(direction))));
break;
}
}
}
}
示例10: AfxSocketInit
DWORD CAsyncUrlReader::ThreadProc()
{
AfxSocketInit(nullptr);
DWORD cmd = GetRequest();
if (cmd != CMD_INIT) {
Reply((DWORD)E_FAIL);
return (DWORD) - 1;
}
try {
CInternetSession is;
CAutoPtr<CStdioFile> fin(is.OpenURL(m_url, 1, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_CACHE_WRITE));
TCHAR path[MAX_PATH], fn[MAX_PATH];
CFile fout;
if (GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
&& fout.Open(fn, modeCreate | modeWrite | shareDenyWrite | typeBinary)) {
m_fn = fn;
char buff[1024];
int len = fin->Read(buff, sizeof(buff));
if (len > 0) {
fout.Write(buff, len);
}
Reply(S_OK);
while (!CheckRequest(&cmd)) {
int len2 = fin->Read(buff, sizeof(buff));
if (len2 > 0) {
fout.Write(buff, len2);
}
}
} else {
Reply((DWORD)E_FAIL);
}
fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
} catch (CInternetException* ie) {
ie->Delete();
Reply((DWORD)E_FAIL);
}
//
cmd = GetRequest();
ASSERT(cmd == CMD_EXIT);
Reply(S_OK);
//
m_hThread = nullptr;
return S_OK;
}
示例11: CmdMove
void
CmdMove(CORE_DATA *cd)
{
USER_DATA *ud = UD(cd);
// the game hasnt started
if (ud->in_progress == false) {
Reply("The game has not yet begun");
return;
}
// check for correct arg count
if (cd->cmd_argc != 2) {
ReplyFmt("Usage: !move Coord,Coord");
ReplyFmt("Example: !move e2,e4");
return;
}
// make sure the player is playing
if (IsPlaying(ud, cd->cmd_name) == false) {
Reply("You are not playing in this match");
return;
}
// replies to players in-game are via arena
// check whos turn it is
if (GetColor(ud, cd->cmd_name) != ud->to_move) {
ArenaMessage("It is not your move");
return;
}
// parse argument
char xstr[3];
char ystr[3];
DelimArgs(xstr, 3, cd->cmd_argv[1], 0, ',', false);
DelimArgs(ystr, 3, cd->cmd_argv[1], 1, ',', false);
int x1, y1, x2, y2;
if (ParseCoords(xstr, &x1, &y1) == true &&
ParseCoords(ystr, &x2, &y2) == true) {
char *err = TryMove(ud, ud->to_move, x1, y1, x2, y2);
if (err == NULL && ud->in_progress == true) {
// successful moves are announced in TryMove()
ud->to_move = GetOppositeColor(ud->to_move);
LvzToMove(ud->to_move, NULL);
ArenaMessageFmt("%s (%s) to Move",
GetPlayerName(ud, ud->to_move), GetColorText(ud->to_move));
} else if (ud->in_progress == true) {
ArenaMessageFmt("Couldn't move: %s", err);
}
} else {
ArenaMessageFmt("Invalid coordinates");
}
}
示例12: SetThreadName
DWORD CBDReaderFilter::ThreadProc()
{
SetThreadName(-1, "BDReader_WORKER");
m_bFlushing = false;
m_eEndFlush.Set();
for (DWORD cmd = (DWORD)-1; ; cmd = GetRequest())
{
if (cmd == CMD_EXIT)
{
m_hThread = NULL;
Reply(S_OK);
return 0;
}
SetThreadPriority(m_hThread, THREAD_PRIORITY_NORMAL);
m_rtStart = m_rtNewStart;
m_rtStop = m_rtNewStop;
if (cmd == CMD_SEEK)
Seek(m_rtStart);
if (cmd != (DWORD)-1)
Reply(S_OK);
// Wait for the end of any flush
m_eEndFlush.Wait();
if (cmd == CMD_SEEK)
{
m_pVideoPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
m_pAudioPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
m_pSubtitlePin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
m_eEndNewSegment.Set();
}
while (!CheckRequest(&cmd))
Sleep(5); // TODO remove polling or maybe start to use the worker thread for pre-caching data
// If we didnt exit by request, deliver end-of-stream
if (!CheckRequest(&cmd))
{
m_pAudioPin->EndOfStream();
m_pVideoPin->EndOfStream();
m_pSubtitlePin->EndOfStream();
}
}
ASSERT(0); // we should only exit via CMD_EXIT
m_hThread = NULL;
return 0;
}
示例13: OnThreadStartPlay
HRESULT CPushAudioPin::DoBufferProcessingLoop(void) {
Command com;
OnThreadStartPlay();
do {
while (!CheckRequest(&com)) {
HRESULT hr;
CAutoLock lock(&m_cSharedState);
if( WaitForSingleObject( this->buffLockEvent, 500 ) == WAIT_OBJECT_0 ){
if( this->buffData.size() != 0 ){
if( this->buffLockEvent != NULL ){
SetEvent(this->buffLockEvent);
}
IMediaSample *pSample;
hr = GetDeliveryBuffer(&pSample,NULL,NULL,0);
if (FAILED(hr)) {
Sleep(1);
continue;
}
hr = FillBuffer(pSample);
if (hr == S_OK) {
hr = Deliver(pSample);
pSample->Release();
if(hr != S_OK)
{
return S_OK;
}
} else if (hr == S_FALSE) {
pSample->Release();
DeliverEndOfStream();
return S_OK;
} else {
pSample->Release();
DeliverEndOfStream();
m_pFilter->NotifyEvent(EC_ERRORABORT, hr, 0);
return hr;
}
}else{
if( this->buffLockEvent != NULL ){
SetEvent(this->buffLockEvent);
}
Sleep(10);
}
}
}
// For all commands sent to us there must be a Reply call!
if (com == CMD_RUN || com == CMD_PAUSE) {
Reply(NOERROR);
} else if (com != CMD_STOP) {
Reply((DWORD) E_UNEXPECTED);
}
} while (com != CMD_STOP);
return S_FALSE;
}
示例14: Affiche_TAGs
void Affiche_TAGs(int fd)
{
Reply(fd,"- %d Tags\n",TAGs.Count);
if (TAGs.Count<=0) return;
ELEMENT *elt=GetFirst(&TAGs);
if (elt!=NULL) do
{
TAG *tag=elt->Data;
Reply(fd,"Tag %p : %s \t\t(Plc %p)\n",tag,tag->TagName,tag->Plc);
} while ((elt=GetNext(&TAGs,elt))!=NULL);
}
示例15: Affiche_Clients
void Affiche_Clients(int fd)
{
Reply(fd,"- %d Clients\n",CLIENTs.Count);
if (CLIENTs.Count<=0) return;
ELEMENT *elt=GetFirst(&CLIENTs);
if (elt!=NULL) do
{
CLIENT *client=elt->Data;
Reply(fd,"Clients %p : %d\n",client,client->FD);
} while ((elt=GetNext(&CLIENTs,elt))!=NULL);
}