MULTITASKING
I need to know whether loops will work in forground background tasks in RAPID and is there any chance of deadlocks or preemption in RAPID programs.If so, will you please provide a reference manual for the examples of deadlocks or multithreading or concurrent programming in RAPID language. Given below are my three simple tasks.
MODULE MAIN
VAR num i;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(i<=2) DO
TPWrite "First line from MAIN";
TPWrite "Second line from MAIN";
TPWrite "Third line from MAIN";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
MODULE BACK1
VAR num j;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(j<=2) DO
TPWrite "First line from BACK1";
TPWrite "Second line from BACK1";
TPWrite "Third line from BACK1";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
MODULE MAIN
VAR num k;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(k<=2) DO
TPWrite "First line from BACK2";
TPWrite "Second line from BACK2";
TPWrite "Third line from BACK2";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
Best Answer
-
I see nothing changing the value of i, j, or k. Main will be caught in infinite loop of WHILE DO.Lee Justice5
Answers
-
Oh.Sorry,That I didn't noticed.Thanks0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings