Commit 295adc21 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Plc threads can now use SCHED_DEADLINE by setting a deadline > 0

parent 8232b1e3
......@@ -38,6 +38,7 @@
Run a PLC thread. */
#include <errno.h>
#include <float.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
......@@ -313,8 +314,8 @@ void plc_thread(plc_sThread* tp)
tp->init(1, tp);
if (tp->PlcThread->Prio < 0) {
thread_SetDeadline(tp->PlcThread);
if (tp->PlcThread->Deadline > FLT_EPSILON) {
sts = thread_SetDeadline(tp->PlcThread);
} else {
sts = thread_SetPrio(&tp->tid, tp->prio);
}
......
......@@ -35,6 +35,7 @@
*/
#include <errno.h>
#include <float.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -248,11 +249,11 @@ pwr_tStatus thread_SetDeadline(pwr_sClass_PlcThread* o)
o->Description, attr.sched_period / (1000 * 1000),
attr.sched_runtime / (1000 * 1000));
}
/*if (o->Deadline) {
if (o->Deadline > FLT_EPSILON) {
attr.sched_deadline = toNs(o->Deadline);
} else {*/
} else {
attr.sched_deadline = toNs(o->ScanTime);
//}
}
int ret = sched_setattr(tid, &attr, 0);
if (ret != 0) {
......
......@@ -74,6 +74,14 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Deadline for the plc thread.
!*/
Object Deadline $Attribute 37
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Plc thread options.
! Specification of the action when the execution time exceeds
! the scantime.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment