Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rtapi/rtapi_uspace.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct RtapiApp
virtual int prio_lowest() const;
int prio_higher_delta() const;
int prio_bound(int prio) const;
bool prio_check(int prio) const;
int prio_next_higher(int prio) const;
int prio_next_lower(int prio) const;
long clock_set_period(long int period_nsec);
Expand Down
12 changes: 11 additions & 1 deletion src/rtapi/uspace_rtapi_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,14 @@ int RtapiApp::prio_bound(int prio) const {
return prio;
}

bool RtapiApp::prio_check(int prio) const {
if(rtapi_prio_highest() > rtapi_prio_lowest()) {
return (prio <= rtapi_prio_highest()) && (prio >= rtapi_prio_lowest());
} else {
return (prio <= rtapi_prio_lowest()) && (prio >= rtapi_prio_highest());
}
}

int RtapiApp::prio_next_higher(int prio) const
{
prio = prio_bound(prio);
Expand Down Expand Up @@ -899,8 +907,10 @@ int RtapiApp::allocate_task_id()
int RtapiApp::task_new(void (*taskcode) (void*), void *arg,
int prio, int owner, unsigned long int stacksize, int uses_fp) {
/* check requested priority */
if ((prio > rtapi_prio_highest()) || (prio < rtapi_prio_lowest()))
if (!prio_check(prio))
{
rtapi_print_msg(RTAPI_MSG_ERR,"rtapi:task_new prio is not in bound lowest %i prio %i highest %i\n",
rtapi_prio_lowest(), prio, rtapi_prio_highest());
return -EINVAL;
}

Expand Down
Loading