cleaned up a bit, no functional change

This commit is contained in:
Robin Müller 2021-03-06 20:36:54 +01:00
parent 17b8d3fed0
commit 778ef4ef23
1 changed files with 167 additions and 169 deletions

View File

@ -57,10 +57,8 @@ void PosixThread::suspend() {
void PosixThread::resume(){ void PosixThread::resume(){
/* Signal the thread to start. Makes sense to call kill to start or? ;) /* Signal the thread to start. Makes sense to call kill to start or? ;)
* According to POSIX raise(signal) will call pthread_kill(pthread_self(), sig),
* According to Posix raise(signal) will call pthread_kill(pthread_self(), sig), but as the call must be done from the thread itself this is not possible here */
* but as the call must be done from the thread itsself this is not possible here
*/
pthread_kill(thread,SIGUSR1); pthread_kill(thread,SIGUSR1);
} }
@ -68,7 +66,7 @@ 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;
bool shouldDelay = false; bool shouldDelay = false;
//Get current Time /* Get current Time */
const uint64_t currentTime_ms = getCurrentMonotonicTimeMs(); const uint64_t currentTime_ms = getCurrentMonotonicTimeMs();
/* Generate the tick time at which the task wants to wake. */ /* Generate the tick time at which the task wants to wake. */
nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms; nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms;
@ -102,7 +100,7 @@ bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms,
PosixThread::sleep(sleepTime * 1000000ull); PosixThread::sleep(sleepTime * 1000000ull);
return true; return true;
} }
//We are shifting the time in case the deadline was missed like rtems /* We are shifting the time in case the deadline was missed like RTEMS */
(*prevoiusWakeTime_ms) = currentTime_ms; (*prevoiusWakeTime_ms) = currentTime_ms;
return false; return false;
@ -125,10 +123,10 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
#endif #endif
/* /*
* The attr argument points to a pthread_attr_t structure whose contents * The attr argument points to a pthread_attr_t structure whose contents
are used at thread creation time to determine attributes for the new * are used at thread creation time to determine attributes for the new
thread; this structure is initialized using pthread_attr_init(3) and * thread; this structure is initialized using pthread_attr_init(3) and
related functions. If attr is NULL, then the thread is created with * related functions. If attr is NULL, then the thread is created with
default attributes. * default attributes.
*/ */
pthread_attr_t attributes; pthread_attr_t attributes;
int status = pthread_attr_init(&attributes); int status = pthread_attr_init(&attributes);