Welcome to the Linux Foundation Forum!

Why posix thread is running only once ?

npatil15 Posts: 1
edited August 2015 in Software Development


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,


Nitin Patil


  • saqman2060
    saqman2060 Posts: 777
    So is there a senor in this robot that detects smoke and obstacles?
  • saqman2060
    saqman2060 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.


Upcoming Training