本文整理汇总了C++中rt_task_start函数的典型用法代码示例。如果您正苦于以下问题:C++ rt_task_start函数的具体用法?C++ rt_task_start怎么用?C++ rt_task_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rt_task_start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(){
rt_print_auto_init(1);
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_task_shadow(NULL, "main", 5, T_CPU(0)|T_JOINABLE);
#ifdef mutex
rt_mutex_create(&a, "Mutex");
rt_mutex_create(&b, "b");
#endif
rt_task_create(&task1, "Task1", 0, 1, T_CPU(0)|T_JOINABLE);
rt_task_create(&task2, "Task2", 0, 2, T_CPU(0)|T_JOINABLE);
rt_task_start(&task1, &semWait1, NULL);
rt_task_start(&task2, &semWait2, NULL);
rt_printf("sync \n");
rt_task_join(&task1);
rt_task_join(&task2);
#ifdef mutex
rt_mutex_delete(&a);
rt_mutex_delete(&b);
#endif
}
开发者ID:magnealvnor,项目名称:Sanntidssystemer,代码行数:27,代码来源:assA.c
示例2: startup
//startup code
void startup(){
int err = 0;
// semaphore to sync task startup on
err = rt_sem_create(&mysync,"MySemaphore",1,S_FIFO);
if(err < 0) rt_printf("Failed to create semaphore; error: %d: %s", err, strerror(-err));
err = 0;
// set timing to ns
rt_timer_set_mode(BASEPERIOD);
err = rt_task_create(&highP, "high", 0, HIGH, 0);
if(err < 0) rt_printf("Failed to create task high; error: %d: %s", err, strerror(-err));
err = 0;
err = rt_task_start(&highP, &prioHigh, 0);
if(err < 0) rt_printf("Failed to start task high; error: %d: %s", err, strerror(-err));
err = 0;
err = rt_task_create(&midP, "mid", 0, MID, 0);
if(err < 0) rt_printf("Failed to create task medium; error: %d: %s", err, strerror(-err));
err = 0;
err = rt_task_start(&midP, &prioMid, 0);
if(err < 0) rt_printf("Failed to start task medium; error: %d: %s", err, strerror(-err));
err = 0;
err = rt_task_create(&lowP, "low", 0, LOW, 0);
if(err < 0) rt_printf("Failed to create task low; error: %d: %s", err, strerror(-err));
err = 0;
err = rt_task_start(&lowP, &prioLow, 0);
if(err < 0) rt_printf("Failed to start task low; error: %d: %s", err, strerror(-err));
err = 0;
}
开发者ID:PimJager,项目名称:SoftwaredesignEmSys,代码行数:31,代码来源:ex08a.c
示例3: main
int main(){
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_print_auto_init(1);
rt_sem_create(&semaphore, "sem", 1, S_PRIO);
rt_sem_create(&synca, "sync", 0, S_PRIO);
rt_mutex_create(&mutex, "mutex");
RT_TASK L, M, H;
rt_task_shadow(NULL, "main", 4, T_CPU(1)|T_JOINABLE);
rt_task_create(&L, "low", 0, 1, T_CPU(1)|T_JOINABLE);
rt_task_create(&M, "medium", 0, 2, T_CPU(1)|T_JOINABLE);
rt_task_create(&H, "high", 0, 3, T_CPU(1)|T_JOINABLE);
rt_task_start(&L, &low, (void*) 0);
rt_task_start(&M, &medium, (void*) 0);
rt_task_start(&H, &high, (void*) 0);
usleep(100000);
rt_printf("RELEASING SYNC\n");
rt_sem_broadcast(&synca);
rt_task_join(&L);
rt_task_join(&M);
rt_task_join(&H);
rt_sem_delete(&synca);
rt_sem_delete(&semaphore);
rt_mutex_delete(&mutex);
return 0;
}
开发者ID:ThorbjornSomod,项目名称:sanntidssystemer,代码行数:34,代码来源:assB.c
示例4: main
int main() {
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_print_auto_init(1);
RT_TASK low, med, high, sync;
rt_task_create(&low, "low", 0, 10, T_CPU(1)|T_JOINABLE);
rt_task_create(&med, "med", 0, 20, T_CPU(1)|T_JOINABLE);
rt_task_create(&high, "high", 0, 30, T_CPU(1)|T_JOINABLE);
rt_task_create(&sync, "sync", 0, 99, T_CPU(1)|T_JOINABLE);
rt_sem_create(&sem, "sem", 0, S_PRIO);
rt_sem_create(&resourceSem, "resourceSem", 1, S_PRIO);
rt_mutex_create(&resourceMutex, "resourceMutex");
rt_task_start(&low, &lowFunc, NULL);
rt_task_start(&med, &medFunc, NULL);
rt_task_start(&high, &highFunc, NULL);
rt_task_start(&sync, &syncFunc, NULL);
rt_task_join(&low);
rt_task_join(&med);
rt_task_join(&high);
rt_task_join(&sync);
rt_sem_delete(&sem);
rt_sem_delete(&resourceSem);
rt_mutex_delete(&resourceMutex);
return 0;
}
开发者ID:martinjensen91,项目名称:ttk4147,代码行数:32,代码来源:main.c
示例5: main
int main(int argc, char* argv[])
{
signal(SIGTERM, catch_signal);
//signal(SIGINT, catch_signal);
int statusA, statusG, statusF, mutexacc, mutexgyro, i,j;
logIndex = 0;
// enable rt_task_print
rt_print_auto_init(1);
/* Avoids memory swapping for this program */
mlockall(MCL_CURRENT|MCL_FUTURE);
// Create mutexs
mutexgyro = rt_mutex_create(&mutex_gyro,NULL);
if(mutexgyro!=0){
fprintf(stderr, "Unable to create gyroscope mutex! Exiting...\n");
exit(EXIT_FAILURE);
}
mutexacc = rt_mutex_create(&mutex_acc,NULL);
if(mutexacc!=0){
fprintf(stderr, "Unable to create accelorometer mutex! Exiting...\n");
exit(EXIT_FAILURE);
}
isRunning = 1;
/*
* Arguments: &task, name, stack size (0=default), priority,
* mode (FPU, start suspended, ...)
*/
statusA = rt_task_create(&accThread, NULL, 0, 0, T_JOINABLE);
statusG = rt_task_create(&gyroThread, NULL, 0, 0, T_JOINABLE);
statusF = rt_task_create(&fusThread, NULL, 0, 0, T_JOINABLE);
/*
* Arguments: &task, task function, function argument
*/
statusA = rt_task_start(&accThread, &accelerometer, NULL);
statusG = rt_task_start(&gyroThread, &gyroscope, NULL);
statusF = rt_task_start(&fusThread, &sensor_fusion, NULL);
// threads in infinite loop, therefore this prevents the main from finishing
// (and killing its threads)
statusA = rt_task_join(&gyroThread);
statusF = rt_task_join(&fusThread);
statusG = rt_task_join(&accThread);
printlog[logIndex] = 4000;
for (i = 0; i < 50; i++) {
printf("Fusion%d: %d\n", i, printlog[i]);
}
rt_mutex_delete(&mutex_acc);
rt_mutex_delete(&mutex_gyro);
}
开发者ID:AndrewDeCHamplain,项目名称:SYSC3303,代码行数:60,代码来源:partB.c
示例6: main
int main(int argc, char* argv[])
{
// Perform auto-init of rt_print buffers if the task doesn't do so
rt_print_auto_init(1);
// Lock memory : avoid memory swapping for this program
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_printf("starting tasks\n");
/*
* Arguments: &task,
* name,
* stack size (0=default),
* priority,
* mode (FPU, start suspended, ...)
*/
rt_task_create(&task1, "t1", 0, 50, 0);
rt_task_create(&task2, "t2", 0, 50, 0);
rt_task_create(&task3, "t3", 0, 50, 0);
rt_task_create(&task4, "t4", 0, 50, 0);
rt_task_create(&task5, "t5", 0, 50, 0);
/*
* Arguments: &task,
* task function,
* function argument
*/
rt_task_start(&task1, &task, 0);
rt_task_start(&task2, &task, 0);
rt_task_start(&task3, &task, 0);
rt_task_start(&task4, &task, 0);
rt_task_start(&task5, &task, 0);
}
开发者ID:PimJager,项目名称:SoftwaredesignEmSys,代码行数:35,代码来源:ex02a.c
示例7: startup
void startup(){
rt_queue_create(&rqueue, "rQueue", QUEUE_SIZE, 40, Q_FIFO);
rt_queue_create(&lqueue, "lQueue", QUEUE_SIZE, 40, Q_FIFO);
//rt_sem_create(&rsem, "rsem", 0, S_FIFO);
//&task, name, stack size (0 - default), priority, mode
rt_task_create(&rEnc_task, "rEnc Task", 0, 50, 0);
//&task, task function, function argument
rt_task_start(&rEnc_task, &rEnc, 0);
//&task, name, stack size (0 - default), priority, mode
rt_task_create(&lEnc_task, "lEnc Task", 0, 50, 0);
//&task, task function, function argument
rt_task_start(&lEnc_task, &lEnc, 0);
//&task, name, stack size (0 - default), priority, mode
rt_task_create(&Odo_task, "Odo Task", 0, 60, 0);
//&task, task function, function argument
rt_task_start(&Odo_task, &Odo, 0);
//rt_sem_broadcast(&rsem);
}
开发者ID:sshriya,项目名称:Beaglebonepy,代码行数:25,代码来源:odometry.c
示例8: main
int main(int argc, char *const argv[])
{
int ret;
traceobj_init(&trobj, argv[0], 0);
ret = rt_sem_create(&sem, "SEMA", 0, S_FIFO);
traceobj_check(&trobj, ret, 0);
ret = rt_task_create(&t_rr1, "rr_task_1", 0, 10, 0);
traceobj_check(&trobj, ret, 0);
ret = rt_task_start(&t_rr1, rr_task, "t1");
traceobj_check(&trobj, ret, 0);
ret = rt_task_create(&t_rr2, "rr_task_2", 0, 10, 0);
traceobj_check(&trobj, ret, 0);
ret = rt_task_start(&t_rr2, rr_task, "t2");
traceobj_check(&trobj, ret, 0);
ret = rt_sem_broadcast(&sem);
traceobj_check(&trobj, ret, 0);
traceobj_join(&trobj);
exit(0);
}
开发者ID:rcn-ee,项目名称:xenomai-3,代码行数:28,代码来源:task-8.c
示例9: main
int main(int argc, char* argv[])
{
// Perform auto-init of rt_print buffers if the task doesn't do so
rt_print_auto_init(1);
// Lock memory : avoid memory swapping for this program
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_printf("starting tasks\n");
int res = rt_sem_create(&semGlobal, "a", 0, S_PRIO);
if(res < 0) rt_printf("Failed to create semaphore; error: %d: %s", res, strerror(-res));
rt_task_create(&task1, "t1", 0, 10, 0);
rt_task_create(&task2, "t2", 0, 20, 0);
rt_task_create(&task3, "t3", 0, 30, 0);
rt_task_create(&task4, "t4", 0, 40, 0);
rt_task_create(&task5, "t5", 0, 50, 0);
int a1 = 1;
int a2 = 2;
int a3 = 3;
int a4 = 4;
int a5 = 5;
rt_task_start(&task1, &task, &a1);
rt_task_start(&task2, &task, &a2);
rt_task_start(&task3, &task, &a3);
rt_task_start(&task4, &task, &a4);
rt_task_start(&task5, &task, &a5);
rt_sem_broadcast(&semGlobal);
}
开发者ID:PimJager,项目名称:SoftwaredesignEmSys,代码行数:35,代码来源:ex03c1.c
示例10: startup
//startup code
void startup()
{
rt_intr_create(&keypress, NULL, KEYBOARD_IRQ, I_PROPAGATE);
rt_task_create(&key_isr, NULL,0,50,0);
rt_task_start(&key_isr, &key_handler, NULL);
// Higher priority
rt_task_create(&dummy, NULL,0,53,0);
rt_task_start(&dummy, &dummy_task, NULL);
}
开发者ID:dopefishh,项目名称:des2015,代码行数:12,代码来源:ex09a2.c
示例11: startup
void startup(){
// rt_task_create(&rMotor_task, "rMotor Task", 0, 50, 0);
// rt_task_create(&lMotor_task, "lMotor Task", 0, 50, 0);
//rt_task_create(&rMotor_stop_task, "rMotor Stop Task", 0, 51, 0);
//rt_task_create(&lMotor_stop_task, "lMotor Stop Task", 0, 51, 0);
rt_task_create(&rMotor_task, "rMotor Task", 0, 50, 0);
rt_task_create(&lMotor_task, "lMotor Task", 0, 50, 0);
// rt_task_start(&rMotor_stop_task, &rMotor_stop, 0);
//rt_task_start(&lMotor_stop_task, &lMotor_stop, 0);
rt_task_start(&rMotor_task, &rMotor, 0);
rt_task_start(&lMotor_task, &lMotor, 0);
}
开发者ID:sshriya,项目名称:Beaglebonepy,代码行数:13,代码来源:controlMotor_file.c
示例12: mlockall
RealtimeController::RealtimeController()
{
// lukitaan ohjelman nykyinen ja tuleva muisti niin että se pysyy RAM:ssa kokoajan
mlockall(MCL_CURRENT | MCL_FUTURE);
int xenoError = 0;
// luodaan task-handle reaaliaikasäikeelle
// antamalla T_FPU | T_JOINABLE saattaisi olla mahdollista käyttää
// mittausarvoja doubleina Voltteina koko ohjelmassa
xenoError = rt_task_create(&task_desc, NULL, 0, 99, T_JOINABLE);
xenoError = rt_pipe_create(&pipe_desc, NULL, 0, 0);
if(xenoError != 0)
qDebug("rt init error");
// käynnistetään säie
rt_task_start(&task_desc, &realtimeLoop, NULL);
// luodaan pipe reaaliaikasäikeen kanssa kommunikointiin
pipefd = open("/dev/rtp0", O_RDWR, 0);
if (pipefd < 0)
qDebug("Creating pipe failed");
// pysäytetään säätö oletuksena
stop();
}
开发者ID:hsarkanen,项目名称:ActuatorControlInMicrosystem,代码行数:27,代码来源:realtimecontroller.cpp
示例13: while
bool RTROSMotorSettingService::motorSet(rt_dynamixel_msgs::MotorSettingRequest &req,
rt_dynamixel_msgs::MotorSettingResponse &res)
{
for(int i=0; i<4; i++)
{
dxlDevice[i].bControlLoopEnable = false;
}
for(int i=0; i<4; i++)
{
while(dxlDevice[i].bControlLoopProcessing) {}
}
RT_TASK rttMotorSetTask;
rt_task_create(&rttMotorSetTask,"dxl motorset service",0,7,T_JOINABLE);
motorResponse.result = -1;
motorRequest = req;
rt_task_start(&rttMotorSetTask, &motor_set_proc, (void*)this);
rt_task_join(&rttMotorSetTask);
rt_task_delete(&rttMotorSetTask);
res = motorResponse;
//res.result = req.mode;
for(int i=0; i<4; i++)
{
dxlDevice[i].bControlLoopEnable = true;
}
return true;
}
开发者ID:jmpechem,项目名称:sm_n_vis,代码行数:32,代码来源:rt_ros_service.cpp
示例14: assignmentA
void assignmentA(int period_us, int ndisturbance)
{
printf("Starting Assignment A!\n");
period_ns = period_us * 1000;
RT_TASK rt[N_RT];
pthread_t ts[ndisturbance];
char *names[N_RT] = { "thread_a", "thread_b", "thread_c" };
int channels[N_RT] = { CHANNEL_A, CHANNEL_B, CHANNEL_C };
mlockall(MCL_CURRENT | MCL_FUTURE);
int i;
for (i = 0; i < ndisturbance; i++)
{
pthread_create(&ts[i], 0, disturbanceInTheForce, NULL);
}
for (i = 0; i < N_RT; i++)
{
rt_task_create(&rt[i], names[i], 0, 99, 0);
rt_task_start(&rt[i], responseHandlerPeriodic, &channels[i]);
}
while (1);
}
开发者ID:msholsve,项目名称:rtkos,代码行数:27,代码来源:main.c
示例15: main
int main (int argc, char *argv[])
{
static char *messages[] = { "hello", "world", NULL };
int n, len;
void *msg;
mlockall(MCL_CURRENT|MCL_FUTURE);
err = rt_task_create(&task_desc,
"MyTaskName",
TASK_STKSZ,
TASK_PRIO,
TASK_MODE);
if (!err)
rt_task_start(&task_desc,&task_body,NULL);
/* ... */
for (n = 0; messages[n] != NULL; n++)
{
len = strlen(messages[n]) + 1;
/* Get a message block of the right size. */
msg = rt_queue_alloc(&q_desc,len);
if (!msg)
/* No memory available. */
fail();
strcpy(msg,messages[n]);
rt_queue_send(&q_desc,msg,len,Q_NORMAL);
}
rt_task_delete(&task_desc);
}
开发者ID:BhargavKola,项目名称:xenomai-forge,代码行数:35,代码来源:msg_queue.c
示例16: main
int main (int argc, char * argv[]){
rt_print_auto_init(1);
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_sem_create(&semGlobal1,"semaphore1",1,S_FIFO);
rt_sem_create(&semGlobal2,"semaphore2",0,S_FIFO);
rt_task_create(&t1,"taskOne",0,10,0);
rt_task_create(&t2,"taskTwo",0,10,0);
rt_task_start(&t1,&taskOne,NULL);
rt_task_start(&t2,&taskTwo,NULL);
//rt_printf("end program by CTRL-C\n");
//pause();
}
开发者ID:dbellavista,项目名称:edfomai,代码行数:16,代码来源:semaphore.c
示例17: main
int main ()
{
io_init();
RT_TASK test[3];
mlockall(MCL_CURRENT|MCL_FUTURE);
char name[10];
long i;
for (i = 1; i <= 3; i++) {
sprintf(name, "test%lu", i);
rt_task_create(&test[i-1], name, 0, i, T_CPU(1)|T_JOINABLE);
rt_task_start(&test[i-1], &periodicTest, (void*) i);
}
pthread_t disturbances[10];
for (i = 0; i < 10; i++) {
pthread_create(&disturbances[i], NULL, disturbance, NULL);
}
for (i = 0; i < 10; i++) {
pthread_join(disturbances[i], NULL);
}
wait_for_ctrl_c();
return 0;
}
开发者ID:martinjensen91,项目名称:ttk4147,代码行数:29,代码来源:main.c
示例18: main
int main (int argc, char *argv[])
{
// Enable the on-board GPIO
wiringPiSetup ();
// rt print
rt_print_auto_init(1);
// turn off paging
mlockall(MCL_CURRENT|MCL_FUTURE);
#ifdef DEBUG
rt_printf ("SecureRT - Test\n");
delay(1000);
#endif /*DEBUG*/
// setup pins
pinMode (OUTPUT_PIN, OUTPUT);
pinMode (INPUT_PIN, INPUT);
int err;
// create task
err = rt_task_create(&task_desc,
"SRT_task",
TASK_STKSZ,
TASK_PRIO,
TASK_MODE);
if (!err)
rt_task_start(&task_desc,&task_body,NULL);
while(1){
//wait for rt_task
}
return(0);
}
开发者ID:histind,项目名称:SecureRT,代码行数:31,代码来源:rttask_3des.c
示例19: main
int main(int argc, char **argv) {
char task_name[TASKS][16];
RT_TASK task[TASKS];
rt_print_auto_init(1);
mlockall(MCL_CURRENT|MCL_FUTURE);
for(int i = 0; i < TASKS; i++) {
snprintf(task_name[i], 16, "Lab5Task-%d", i);
if (rt_task_create(&task[i], task_name[i], 0, 50 - (i*2), T_JOINABLE) != 0) {
exit(-1);
}
}
for (int i = 0; i < TASKS; i++) {
rt_printf("Starting task %s\n", task_name[i]);
rt_task_start(&task[i], &task_body, NULL);
}
rt_printf("All tasks started\n");
for(int i = 0; i < TASKS; i++) {
rt_task_join(&task[i]);
}
rt_printf("All tasks stopped, shared_resource = %d\n", shared_resource);
}
开发者ID:jetuuuu,项目名称:edu-cs-rts-lab-assignment-5,代码行数:29,代码来源:lab-5-4.c
示例20: main
int main (int argc, char *argv[]) {
int err;
mlockall(MCL_CURRENT|MCL_FUTURE);
/* Version With 4 param only on userSpace */
err = rt_intr_create(&intr_desc,"MyIrq",70,0);
if (err != 0){
printf("rt_intr_create : error\n");
return 1;
}
err = rt_task_create(&server_desc,
"MyIrqServer",
TASK_STKSZ,
TASK_PRIO,
TASK_MODE);
if (err == 0)
rt_task_start(&server_desc,&irq_server,NULL);
else{
printf("rt_task_start : error\n");
return 1;
}
getchar();
cleanup();
return 0;
}
开发者ID:Wailshire,项目名称:armadeus,代码行数:27,代码来源:interrupt_xeno_userspace.c
注:本文中的rt_task_start函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论