diff --git a/V203/hello/linux/print.cpp b/V203/hello/linux/print.cpp index 66bba97..a97c2e1 100644 --- a/V203/hello/linux/print.cpp +++ b/V203/hello/linux/print.cpp @@ -1,16 +1,22 @@ #include +#include #include "utils.h" +static std::mutex Mutex; + void print_morse_table (const TABLE & tab) { + Mutex.lock(); int n = 0; printf("static const unsigned char compressed_table [] = {"); for (auto & e: tab) { - if ((n % 16) == 0) printf("\n"); + if ((n % 16) == 0) printf("\n "); printf("0x%02x,", e); n++; } printf("\n};\n"); + Mutex.unlock(); } void print_sinus_table (const TABLE & tab) { + Mutex.lock(); int n = 0; printf("static const uint16_t sin_tab [] = {"); for (auto & e: tab) { @@ -19,4 +25,5 @@ void print_sinus_table (const TABLE & tab) { n++; } printf("\n};\n"); + Mutex.unlock(); }