Welcome to the Linux Foundation Forum!

Why posix thread is running only once ?

Posts: 1
edited August 2015 in Software Development

Hi,

I have problem regarding executing thread program.

I develop a robot for that m using concept of threading for creating a real time scenario to avoid obstacle and sense smoke in the premises.

So the issue is, it runs only in the starting, after that it get disappear..

here is the code skeleton,

void *thread1()
{
while(smoke_detect()==1 || obstacle()==1)
{
stop the robot;
}
}


Please reply me,

Thanking you in advance,

Regards,

Nitin Patil

Comments

  • Posts: 777
    So is there a senor in this robot that detects smoke and obstacles?
  • Posts: 777
    As I have read this program, the "while" loop will not run if there are no smoke or obstacles. So when the robot starts and detects nothing, the program will not run. You might want to convert this to an if_then_else or a condition statement. While one then the other, if one is true do nothing in that theory. Hope this helps.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training