LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   thread scheduler disable & enable (https://www.linuxquestions.org/questions/linux-newbie-8/thread-scheduler-disable-and-enable-605820/)

balaji_singh 12-10-2007 09:40 AM

thread scheduler disable & enable
 
Hi,

i'am runing 30 threads in a single process & i want the feature to disable & enable the thread scheduler in few threads, i would like to know what are the API's that can be called directly from the APPlication thread to stop the scheduler & start the scheduler.

I tried with ptherad_spin_lock() & pthread_spin_unlock() at the application level....able to compile the code,since the architecture is not an SMP architecture the exection has went to an while(1) mode.

I tried with preempt_enable() & preempt_disable() at the application level....failed to compile the code.

my code:
while(1)
{
preempt_disable();

/* HB LED - 600ms ON state */
ioctl(miscgl, 1, NULL);
usleep(1000 * 600);

/* HB LED - 600ms OFF state */
ioctl(miscgl, 2, NULL);
usleep(1000 * 600);

/* ESD-change - Check for PHY status and reset */
if(stop_trigger_flag == 0)
ioctl(miscgl, ESD_change, NULL);
preempt_enable();


}


compilation errors:
hblmain.c: In function `HBLENT':
hblmain.c:181: error: invalid type argument of `->'
hblmain.c:194: error: invalid type argument of `->'
hblmain.c:194: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
hblmain.c:194: error: (Each undeclared identifier is reported only once
hblmain.c:194: error: for each function it appears in.)
make[2]: *** [hblmain.o] Error 1

Regards
Balaji singh

sundialsvcs 12-11-2007 08:02 PM

Wow.

Maybe you should start by reconsidering exactly what it is you are trying to accomplish. Maybe you're taking the wrong approach. Thirty(?!?!?!) threads...


All times are GMT -5. The time now is 06:59 AM.