![RobotStudio event](https://new.abb.com/images/librariesprovider89/default-album/rs_webinar_invitation_2025_2.jpg)
MULTITASKING
![AMEENA](https://secure.gravatar.com/avatar/bcbac1c396047b4c9814ceb3f7d65280/?default=https%3A%2F%2Fus.v-cdn.net%2F5020483%2Fuploads%2Fdefaultavatar%2FK2266OAKOLNC.jpg&rating=g&size=200)
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
- 398 UpFeed
- 19 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 321 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 808 RAPID Programming
- 5 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings