本文整理汇总了C++中Nullable::Resize方法的典型用法代码示例。如果您正苦于以下问题:C++ Nullable::Resize方法的具体用法?C++ Nullable::Resize怎么用?C++ Nullable::Resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nullable
的用法示例。
在下文中一共展示了Nullable::Resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: worker_func
void Console::worker_func () noexcept {
// STDIN
HANDLE in;
// Screen buffer
Nullable<ConsoleScreenBuffer> buffer;
// Console mode when this thread
// started
DWORD mode;
try {
// Get handles
in=get_std_handle(STD_INPUT_HANDLE);
if (!(
// Attempt to cache old console
// mode so that it can be restored
// when this thread exits
GetConsoleMode(
in,
&mode
) &&
// Attempt to set new console mode,
// enabling the receipt of resize
// messages
SetConsoleMode(
in,
mode|ENABLE_WINDOW_INPUT
)
)) Raise();
// Create buffer
try {
HANDLE out=get_std_handle(STD_OUTPUT_HANDLE);
if (output_max.IsNull()) buffer.Construct(out);
else buffer.Construct(out,*output_max);
} catch (...) {
// Restore original console
// mode on failure
SetConsoleMode(
in,
mode
);
throw;
}
} catch (...) {
// Startup failed, notify
// constructor
except=std::current_exception();
barrier.Enter();
// ABORT
return;
}
// Startup success, notify
// constructor
barrier.Enter();
// Prepare handles to wait
// on
HANDLE handles []= {stop,in,queued};
try {
// Worker loop
for (;;) {
// Wait
auto result=WaitForMultipleObjects(
static_cast<DWORD>(std::extent<decltype(handles)>::value),
handles,
false,
poll_freq
);
// Did the wait fail?
if (result==WAIT_FAILED) Raise();
// Did the wait timeout?
if (result==WAIT_TIMEOUT) {
buffer->Resize();
continue;
}
//.........这里部分代码省略.........