using strncat now

This commit is contained in:
Robin Müller 2020-06-06 18:56:54 +02:00
parent b79efa6d6c
commit 262d34174e

View File

@ -5,7 +5,8 @@
PosixThread::PosixThread(const char* name_, int priority_, size_t stackSize_): PosixThread::PosixThread(const char* name_, int priority_, size_t stackSize_):
thread(0),priority(priority_),stackSize(stackSize_) { thread(0),priority(priority_),stackSize(stackSize_) {
strncpy(name, name_, PTHREAD_MAX_NAMELEN); name[0] = '\0';
std::strncat(name, name_, PTHREAD_MAX_NAMELEN - 1);
} }
PosixThread::~PosixThread() { PosixThread::~PosixThread() {
@ -59,10 +60,6 @@ void PosixThread::resume(){
pthread_kill(thread,SIGUSR1); pthread_kill(thread,SIGUSR1);
} }
bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms, bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms,
const uint64_t delayTime_ms) { const uint64_t delayTime_ms) {
uint64_t nextTimeToWake_ms; uint64_t nextTimeToWake_ms;
@ -208,7 +205,6 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
" did not work.." << std::endl; " did not work.." << std::endl;
} }
} }
} }
status = pthread_attr_destroy(&attributes); status = pthread_attr_destroy(&attributes);