OpenClonk
C4StdInProc.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2010-2016, The OpenClonk Team and contributors
5  *
6  * Distributed under the terms of the ISC license; see accompanying file
7  * "COPYING" for details.
8  *
9  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
10  * See accompanying file "TRADEMARK" for details.
11  *
12  * To redistribute this file separately, substitute the full license texts
13  * for the above references.
14  */
15 
16 #ifndef INC_C4STDINPROC
17 #define INC_C4STDINPROC
18 
19 #include "platform/StdScheduler.h"
20 
21 // A simple alertable proc
23 {
24 public:
26  ~C4StdInProc() override;
27 
28  // StdSchedulerProc override
29  bool Execute(int iTimeout, pollfd *) override;
30 #ifdef STDSCHEDULER_USE_EVENTS
31  HANDLE GetEvent() override { return GetStdHandle(STD_INPUT_HANDLE); }
32 #else
33  void GetFDs(std::vector<struct pollfd> & checkfds) override
34  {
35  pollfd pfd = { 0, POLLIN | POLLERR | POLLHUP, 0 };
36  checkfds.push_back(pfd);
37  }
38 #endif
39 private:
40  // commands from stdin
41  StdCopyStrBuf CmdBuf;
42 };
43 
44 #endif /* INC_C4STDINPROC */
void GetFDs(std::vector< struct pollfd > &checkfds) override
Definition: C4StdInProc.h:33
bool Execute(int iTimeout, pollfd *) override
Definition: C4StdInProc.cpp:66
~C4StdInProc() override