Thread names and cosmetics
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const char * eepromFile = NULL;
|
||||
FILE * fp = NULL;
|
||||
const char * eepromFile = nullptr;
|
||||
FILE * fp = nullptr;
|
||||
|
||||
uint32_t eeprom_pointer;
|
||||
uint8_t * eeprom_buffer_data;
|
||||
@@ -33,7 +33,7 @@ bool eeprom_thread_running = false;
|
||||
#if defined(EEPROM_SIZE)
|
||||
uint8_t eeprom[EEPROM_SIZE];
|
||||
#else
|
||||
uint8_t * eeprom = NULL;
|
||||
uint8_t * eeprom = nullptr;
|
||||
#endif
|
||||
|
||||
sem_t * eeprom_write_sem;
|
||||
@@ -75,7 +75,7 @@ void * eeprom_thread_function(void *)
|
||||
{
|
||||
while (!sem_wait(eeprom_write_sem)) {
|
||||
if (!eeprom_thread_running)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
assert(eeprom_buffer_size);
|
||||
if (eeprom_read_operation) {
|
||||
eepromReadBlock(eeprom_buffer_data, eeprom_pointer, eeprom_buffer_size);
|
||||
@@ -162,17 +162,20 @@ void StartEepromThread(const char * filename)
|
||||
sem_init(eeprom_write_sem, 0, 0);
|
||||
#endif
|
||||
|
||||
if (!pthread_create(&eeprom_thread_pid, NULL, &eeprom_thread_function, NULL))
|
||||
if (!pthread_create(&eeprom_thread_pid, nullptr, &eeprom_thread_function, nullptr)) {
|
||||
pthread_setname_np(eeprom_thread_pid, "eeprom");
|
||||
eeprom_thread_running = true;
|
||||
else
|
||||
}
|
||||
else {
|
||||
perror("Could not create eeprom thread.");
|
||||
}
|
||||
}
|
||||
|
||||
void StopEepromThread()
|
||||
{
|
||||
eeprom_thread_running = false;
|
||||
sem_post(eeprom_write_sem);
|
||||
pthread_join(eeprom_thread_pid, NULL);
|
||||
pthread_join(eeprom_thread_pid, nullptr);
|
||||
|
||||
#ifdef __APPLE__
|
||||
sem_close(eeprom_write_sem);
|
||||
|
||||
Reference in New Issue
Block a user