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
 - 401 UpFeed
 - 21 Tutorials
 - 15 RobotApps
 - 306 PowerPacs
 - 407 RobotStudio S4
 - 1.8K Developer Tools
 - 250 ScreenMaker
 - 2.9K Robot Controller
 - 363 IRC5
 - 81 OmniCore
 - 8 RCS (Realistic Controller Simulation)
 - 853 RAPID Programming
 - 31 AppStudio
 - 4 RobotStudio AR Viewer
 - 19 Wizard Easy Programming
 - 110 Collaborative Robots
 - 5 Job listings
 
