Locked tasks

Kamen Penev kamen at penev.net
Wed Jun 4 00:35:12 UTC 2003


This is how I initialize my round-robin tasks now:

    struct sched_param sp;
    pthread_attr_t attr;

    sp.sched_priority = 10;

    /* Construct pthread_attr */

    pthread_attr_init( &attr);
    pthread_attr_setstacksize(&attr, MY_STACK_SIZE);
    pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
    pthread_attr_setschedpolicy(&attr, SCHED_RR);
    pthread_attr_setschedparam(&attr, &sp);
   
    for (t = 0; t < STEPER_TASKS; ++t) {
        pthread_create(
            &Task_id[STP_TASK0+t],        /* thread id */
            &attr,                    /* attributes */
            (START_ROUTINE *) Task_Steper, /* start_routine */
            (void*)t);                    /* arg */
    }
 
Kamen





More information about the users mailing list