Skip to content

Commit

Permalink
ci: windows-2019
Browse files Browse the repository at this point in the history
Change-Id: I5a1f8feaae931d5e32cbc404dc9835b8d379fbe0
  • Loading branch information
calcitem committed Jun 15, 2024
1 parent f3890a4 commit c96faaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/msix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build:
runs-on: windows-latest
runs-on: windows-2019
defaults:
run:
shell: bash
Expand Down
14 changes: 9 additions & 5 deletions src/ui/flutter_app/command/command_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ CommandQueue::CommandQueue()

bool CommandQueue::write(const char *command)
{
std::unique_lock<std::mutex> lk(mutex);
mutex.lock(); // Exception

if (strlen(commands[writeIndex]) != 0) {
mutex.unlock();
return false;
}

Expand All @@ -52,24 +53,26 @@ bool CommandQueue::write(const char *command)
writeIndex = 0;
}

mutex.unlock();
return true;
}

bool CommandQueue::read(char *dest)
{
std::unique_lock<std::mutex> lk(mutex);
mutex.lock();

if (readIndex == -1) {
mutex.unlock();
return false;
}

#ifdef _MSC_VER
// See uci.cpp LINE_INPUT_MAX_CHAR
strncpy_s(dest, 4096, (char const *)commands[readIndex], 4096);
strncpy_s(commands[readIndex], 4096, "", COMMAND_LENGTH);
strncpy_s(dest, COMMAND_LENGTH, (char const *)commands[readIndex], COMMAND_LENGTH);
strncpy_s(commands[readIndex], COMMAND_LENGTH, "", COMMAND_LENGTH);
#else
// See uci.cpp LINE_INPUT_MAX_CHAR
strncpy(dest, commands[readIndex], 4096);
strncpy(dest, commands[readIndex], COMMAND_LENGTH);
strncpy(commands[readIndex], "", COMMAND_LENGTH);
#endif

Expand All @@ -81,5 +84,6 @@ bool CommandQueue::read(char *dest)
readIndex = -1;
}

mutex.unlock();
return true;
}

0 comments on commit c96faaa

Please sign in to comment.