本文整理汇总了C++中rtems_task_set_priority函数的典型用法代码示例。如果您正苦于以下问题:C++ rtems_task_set_priority函数的具体用法?C++ rtems_task_set_priority怎么用?C++ rtems_task_set_priority使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtems_task_set_priority函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch_priorities
static void switch_priorities(test_context *self)
{
rtems_status_code sc;
size_t index = self->task_index;
size_t next = (index + 1) & 0x1;
size_t task_high = index;
size_t task_low = next;
rtems_task_priority priority;
self->task_index = next;
sc = rtems_task_set_priority(
self->validate_tasks[task_high],
PRIORITY_HIGH,
&priority
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_set_priority(
self->validate_tasks[task_low],
PRIORITY_LOW,
&priority
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:25,代码来源:init.c
示例2: test_create_initially_locked_prio_inherit_sema
static void test_create_initially_locked_prio_inherit_sema(void)
{
rtems_status_code sc;
rtems_id id;
rtems_task_priority prio_a;
rtems_task_priority prio_b;
rtems_task_priority prio_ceiling = 0;
sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_a);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio_a != prio_ceiling);
sc = rtems_semaphore_create(
rtems_build_name( 'S', 'E', 'M', 'A' ),
0,
RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
prio_ceiling,
&id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_b);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio_a == prio_b);
sc = rtems_semaphore_release(id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_semaphore_delete(id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:greenmeent,项目名称:rtems,代码行数:33,代码来源:init.c
示例3: test
/*
* Test verifies priority,
* Changes priority by obtaining a higher priority semaphore
* Releases semaphore to return priority
*/
static void test(void)
{
rtems_status_code sc;
rtems_task_priority priority;
rtems_id task_sem;
sc = rtems_semaphore_create(
rtems_build_name('S', 'E', 'M', '0'),
1,
RTEMS_BINARY_SEMAPHORE |
RTEMS_PRIORITY |
RTEMS_PRIORITY_CEILING,
5,
&task_sem
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
printf("Init: priority %d expected %d\n",(int)priority, TASK_PRIORITY );
rtems_test_assert( priority == TASK_PRIORITY );
printf("Init: Obtain Semaphore\n");
sc = rtems_semaphore_obtain (task_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
printf("Init: priority %d expected %d\n",(int)priority, SEM_PRIORITY );
rtems_test_assert( priority == SEM_PRIORITY );
printf("Init: Release Semaphore\n");
rtems_semaphore_release(task_sem);
rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
printf("Init: priority %d expected %d\n",(int)priority, TASK_PRIORITY );
rtems_test_assert( priority == TASK_PRIORITY );
}
开发者ID:Avanznow,项目名称:rtems,代码行数:39,代码来源:init.c
示例4: Task_1
rtems_task Task_1(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_task_priority the_priority;
rtems_task_priority previous_priority;
rtems_test_pause();
status = rtems_task_set_priority(
RTEMS_SELF,
RTEMS_CURRENT_PRIORITY,
&the_priority
);
directive_failed( status, "rtems_task_set_priority" );
printf(
"TA1 - rtems_task_set_priority - get initial "
"priority of self: %02" PRIdrtems_task_priority "\n",
the_priority
);
while( FOREVER ) {
if ( --the_priority == 0 ) {
puts( "TA1 - rtems_task_suspend - suspend TA2" );
status = rtems_task_suspend( Task_id[ 2 ] );
directive_failed( status, "rtems_task_suspend" );
puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" );
status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority );
directive_failed( status, "rtems_task_set_priority" );
status = rtems_task_delete( Task_id[ 2 ] );
directive_failed( status, "rtems_task_delete of TA2" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
printf(
"TA1 - rtems_task_set_priority - set TA2's priority: "
"%02" PRIdrtems_task_priority "\n",
the_priority
);
status = rtems_task_set_priority(
Task_id[ 2 ],
the_priority,
&previous_priority
);
directive_failed( status, "rtems_task_set_priority" );
}
}
开发者ID:Avanznow,项目名称:rtems,代码行数:52,代码来源:task1.c
示例5: Init
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_task_priority previous_priority;
TEST_BEGIN();
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Argument = 0;
Restart_argument = 1;
status = rtems_task_create(
Task_name[ 1 ],
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 1 ]
);
directive_failed( status, "rtems_task_create of TA1" );
status = rtems_task_create(
Task_name[ 2 ],
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 2 ]
);
directive_failed( status, "rtems_task_create of TA2" );
status = rtems_task_create(
Task_name[ 3 ],
10,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 3 ]
);
directive_failed( status, "rtems_task_create of TA3" );
status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
directive_failed( status, "rtems_task_start of TA1" );
status = rtems_task_start( Task_id[ 2 ], Task_2, Argument );
directive_failed( status, "rtems_task_start of TA2" );
status = rtems_task_start( Task_id[ 3 ], Task_3, Argument );
directive_failed( status, "rtems_task_start of TA3" );
status = rtems_task_set_priority( Task_id[ 3 ], 5, &previous_priority );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:60,代码来源:init.c
示例6: initialize_ftpfs
static void initialize_ftpfs(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
int rv = 0;
struct timeval to = {
.tv_sec = 10,
.tv_usec = 0
};
const char *target = RTEMS_FTPFS_MOUNT_POINT_DEFAULT;
rv = mount_and_make_target_path(
NULL,
target,
RTEMS_FILESYSTEM_TYPE_FTPFS,
RTEMS_FILESYSTEM_READ_WRITE,
NULL
);
rtems_test_assert(rv == 0);
sc = rtems_ftpfs_set_verbose(target, true);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_ftpfs_set_timeout(target, &to);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void change_self_priority(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_task_priority cur = 0;
sc = rtems_task_set_priority(RTEMS_SUCCESSFUL, 110, &cur);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:34,代码来源:init.c
示例7: serverTask
/*
* Server Task
*/
static rtems_task serverTask(rtems_task_argument arg)
{
int s, s1;
socklen_t addrlen;
struct sockaddr_in myAddr, farAddr;
rtems_task_priority myPriority;
printf("Create socket.\n");
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
rtems_panic("Can't create socket: %s\n", strerror(errno));
memset(&myAddr, 0, sizeof myAddr);
myAddr.sin_family = AF_INET;
myAddr.sin_port = htons(1234);
myAddr.sin_addr.s_addr = htonl(INADDR_ANY);
printf("Bind socket.\n");
if (bind(s, (struct sockaddr *)&myAddr, sizeof myAddr) < 0)
rtems_panic("Can't bind socket: %s\n", strerror(errno));
if (listen(s, 5) < 0)
printf("Can't listen on socket: %s\n", strerror(errno));
rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &myPriority);
for(;;) {
addrlen = sizeof farAddr;
s1 = accept(s, (struct sockaddr *)&farAddr, &addrlen);
if (s1 < 0)
if (errno == ENXIO)
rtems_task_delete(RTEMS_SELF);
else
rtems_panic("Can't accept connection: %s", strerror(errno));
else
printf("ACCEPTED:%lX\n", ntohl(farAddr.sin_addr.s_addr));
spawnTask(workerTask, myPriority, s1);
}
}
开发者ID:vecnatechnologies,项目名称:rtems,代码行数:37,代码来源:init.c
示例8: set_priority
static void set_priority(rtems_id id, rtems_task_priority prio)
{
rtems_status_code sc;
sc = rtems_task_set_priority(id, prio, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:gedare,项目名称:rtems,代码行数:7,代码来源:init.c
示例9: change_prio
static void change_prio(rtems_id task, rtems_task_priority prio)
{
rtems_status_code sc;
rtems_task_priority unused;
sc = rtems_task_set_priority(task, prio, &unused);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:Avanznow,项目名称:rtems,代码行数:8,代码来源:init.c
示例10: set_task_prio
static void set_task_prio(rtems_id task, rtems_task_priority prio)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_task_priority cur = 0;
sc = rtems_task_set_priority(task, prio, &cur);
ASSERT_SC(sc);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:8,代码来源:init.c
示例11: assert_prio
static void assert_prio(rtems_id task_id, rtems_task_priority expected_prio)
{
rtems_status_code sc;
rtems_task_priority prio;
sc = rtems_task_set_priority(task_id, RTEMS_CURRENT_PRIORITY, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio == expected_prio);
}
开发者ID:gedare,项目名称:rtems,代码行数:9,代码来源:init.c
示例12: Get_current_pri
rtems_task_priority Get_current_pri(void)
{
rtems_status_code status;
rtems_task_priority pri;
status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri);
directive_failed( status, " rtems_task_set_priority ");
return pri;
}
开发者ID:goetzpf,项目名称:rtems,代码行数:9,代码来源:strict_order_mut.c
示例13: getprio
static int getprio(void)
{
rtems_status_code status;
rtems_task_priority pri;
status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri);
directive_failed( status, "rtems_task_set_priority");
return (int)pri;
}
开发者ID:gedare,项目名称:rtems,代码行数:9,代码来源:init.c
示例14: epicsThreadSetPriority
void
epicsThreadSetPriority (epicsThreadId id,unsigned int osip)
{
rtems_id tid = (rtems_id)id;
rtems_status_code sc;
rtems_task_priority pri = epicsThreadGetOssPriorityValue(osip);
sc = rtems_task_set_priority (tid, pri, &pri);
if (sc != RTEMS_SUCCESSFUL)
errlogPrintf("epicsThreadSetPriority failed: %s\n", rtems_status_text (sc));
}
开发者ID:ukaea,项目名称:epics,代码行数:11,代码来源:osdThread.c
示例15: epicsThreadGetPriority
unsigned int epicsThreadGetPriority(epicsThreadId id)
{
rtems_id tid = (rtems_id)id;
rtems_status_code sc;
rtems_task_priority pri;
sc = rtems_task_set_priority (tid, RTEMS_CURRENT_PRIORITY, &pri);
if (sc != RTEMS_SUCCESSFUL)
errlogPrintf("epicsThreadGetPriority failed: %s\n", rtems_status_text (sc));
return epicsThreadGetOsiPriorityValue (pri);
}
开发者ID:ukaea,项目名称:epics,代码行数:11,代码来源:osdThread.c
示例16: Init
static rtems_task Init(
rtems_task_argument argument
)
{
rtems_task_priority prio;
rtems_status_code status;
TEST_BEGIN();
Master = rtems_task_self();
if (RTEMS_MAXIMUM_PRIORITY >= 255)
Priorities = Priorities_High;
else if (RTEMS_MAXIMUM_PRIORITY >= 15)
Priorities = Priorities_Low;
else {
puts( "Test needs at least 16 configured priority levels" );
rtems_test_exit( 0 );
}
prio = RTEMS_MAXIMUM_PRIORITY - 1;
status = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
directive_failed( status, "rtems_task_set_priority" );
if ( sizeof(Priorities_Low) / sizeof(rtems_task_priority) != MAX_TASKS ) {
puts( "Priorities_Low table does not have right number of entries" );
rtems_test_exit( 0 );
}
if ( sizeof(Priorities_High) / sizeof(rtems_task_priority) != MAX_TASKS ) {
puts( "Priorities_High table does not have right number of entries" );
rtems_test_exit( 0 );
}
puts( "Exercising blocking discipline w/extract in FIFO order " );
do_test( RTEMS_FIFO, TRUE );
puts( "Exercising blocking discipline w/unblock in FIFO order" );
do_test( RTEMS_FIFO, FALSE );
rtems_test_pause_and_screen_number( 2 );
puts( "Exercising blocking discipline w/extract in priority order " );
do_test( RTEMS_PRIORITY, TRUE );
puts( "Exercising blocking discipline w/unblock in priority order" );
do_test( RTEMS_PRIORITY, FALSE );
TEST_END();
rtems_test_exit(0);
}
开发者ID:greenmeent,项目名称:rtems,代码行数:51,代码来源:init.c
示例17: thread_delete_hook
static void thread_delete_hook(
Thread_Control *executing,
Thread_Control *deleted
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
if (deleted->Object.id == task_0) {
rtems_task_priority old = 0;
sc = rtems_task_set_priority(task_1, 2, &old);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:14,代码来源:init.c
示例18: rtems_test_assert
static void *thread_b(void *arg)
{
test_context *ctx;
rtems_id scheduler_b_id;
rtems_status_code sc;
rtems_task_priority prio;
int prio_ceiling;
int eno;
ctx = arg;
rtems_test_assert(rtems_get_current_processor() == 0);
sc = rtems_scheduler_ident(SCHED_B, &scheduler_b_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_set_priority(pthread_self(), RTEMS_CURRENT_PRIORITY, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_set_scheduler(pthread_self(), scheduler_b_id, prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(rtems_get_current_processor() == 1);
eno = pthread_mutex_init(&ctx->mtx_b, &ctx->mtx_attr);
rtems_test_assert(eno == 0);
eno = pthread_mutex_getprioceiling(&ctx->mtx_b, &prio_ceiling);
rtems_test_assert(eno == 0);
rtems_test_assert(prio_ceiling == 254);
eno = pthread_mutex_lock(&ctx->mtx_b);
rtems_test_assert(eno == 0);
eno = pthread_mutex_unlock(&ctx->mtx_b);
rtems_test_assert(eno == 0);
eno = pthread_mutex_destroy(&ctx->mtx_b);
rtems_test_assert(eno == 0);
eno = pthread_mutex_getprioceiling(&ctx->mtx_a, &prio_ceiling);
rtems_test_assert(eno == 0);
rtems_test_assert(prio_ceiling == 126);
eno = pthread_mutex_lock(&ctx->mtx_a);
rtems_test_assert(eno == EINVAL);
return ctx;
}
开发者ID:gedare,项目名称:rtems,代码行数:49,代码来源:init.c
示例19: Middle_tasks
rtems_task Middle_tasks(
rtems_task_argument argument
)
{
rtems_task_priority previous_priority;
Task_priority--;
Task_count++;
(void) rtems_task_set_priority(
Task_id[ Task_count ],
Task_priority,
&previous_priority
);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:15,代码来源:task1.c
示例20: First_task
rtems_task First_task(
rtems_task_argument argument
)
{
rtems_task_priority previous_priority;
benchmark_timer_initialize();
Task_priority--;
Task_count++;
(void) rtems_task_set_priority(
Task_id[ Task_count ],
Task_priority,
&previous_priority
);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:17,代码来源:task1.c
注:本文中的rtems_task_set_priority函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论