little fixes

This commit is contained in:
jusax23 2023-11-05 19:44:11 +01:00
parent 181d05ad69
commit 686a2ab92c
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
3 changed files with 9 additions and 3 deletions

View file

@ -35,7 +35,11 @@ int stockfish_main() {
fakeout << QUITOK << "\n"; fakeout << QUITOK << "\n";
#if _WIN32
Sleep(100);
#else
usleep(100000); usleep(100000);
#endif
fakeout.close(); fakeout.close();
fakein.close(); fakein.close();
@ -52,7 +56,7 @@ ssize_t stockfish_stdin_write(char *data) {
std::string data; std::string data;
char buffer[BUFFER_SIZE + 1]; char buffer[BUFFER_SIZE + 1];
char *stockfish_stdout_read() { char* stockfish_stdout_read() {
if (getline(fakeout, data)) { if (getline(fakeout, data)) {
size_t len = data.length(); size_t len = data.length();
size_t i; size_t i;
@ -62,5 +66,5 @@ char *stockfish_stdout_read() {
buffer[i] = 0; buffer[i] = 0;
return buffer; return buffer;
} }
return NULL; return nullptr;
} }

View file

@ -5,6 +5,8 @@
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -46,7 +46,7 @@ class FakeStream {
private: private:
bool closed = false; bool closed = false;
std::queue<std::string> string_queue; std::queue<std::string> string_queue;
std::string line; //std::string line;
std::mutex mutex_guard; std::mutex mutex_guard;
std::condition_variable mutex_signal; std::condition_variable mutex_signal;
}; };