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.6K RobotStudio
- 399 UpFeed
- 20 Tutorials
- 14 RobotApps
- 300 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 828 RAPID Programming
- 12 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings