lock print
This commit is contained in:
parent
dc1a63fbb0
commit
273a477a37
1 changed files with 8 additions and 1 deletions
|
@ -1,16 +1,22 @@
|
|||
#include <cstdio>
|
||||
#include <mutex>
|
||||
#include "utils.h"
|
||||
static std::mutex Mutex;
|
||||
|
||||
void print_morse_table (const TABLE<unsigned char, 64> & 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<unsigned short, 256> & 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<unsigned short, 256> & tab) {
|
|||
n++;
|
||||
}
|
||||
printf("\n};\n");
|
||||
Mutex.unlock();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue