# Multitasking apps with RAB

**URL:** <https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023>\
**Category:** Developer Tools\
**Created:** [July 22, 2008, 12:11pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023 "2008-07-22T12:11:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 22, 2008, 12:11pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/1 "2008-07-22T12:11:01Z")

</div>

Dear All, Is it possible to build multitasking apps without using the multitasking option to be activated ? I’m planning to build it with RAB ..what I’m trying to build is an apps to monitor signals and doing several stuffs in the controller .. is it possible ? i tried it on virtual controller .. it works .. but I haven’t tried it on the controller ..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 22, 2008, 12:48pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/2 "2008-07-22T12:48:22Z")

</div>

Perhaps I’m asking the wrong question . .anyway any thoughts will be welcome .. thanks

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [July 22, 2008, 2:03pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/3 "2008-07-22T14:03:37Z")

</div>

Are you interested in running multiple task in the controller or multiple tasks in the FlexPendant?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 23, 2008, 6:37am UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/4 "2008-07-23T06:37:36Z")

</div>

Actually, I’m interested in running multiple task in the flexpendant .. I need to monitor the signal … here is my gueses ..

I created the C# . .

ex : mythread = new Thread(new ThreadStart(test));

mythread.start();

public void test(){

while (true){

// read IO .. and update changes to the flexpendant

}

}

Are there any other ways to do this … because I personally think this type of code (mycode) will give cpu consuming rate very high..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 23, 2008, 7:14am UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/5 "2008-07-23T07:14:40Z")

</div>

let me restated my posted comment .. I just tried it with virtual signal .. it’s not working … I got an error message from the virtual flexpendant

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 23, 2008, 1:29pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/6 "2008-07-23T13:29:17Z")

</div>

sorry again. . my mistake it’s out of bound issue .. the code works .. anyway .. can any of you guys please give some insight ..

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [July 23, 2008, 2:52pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/7 "2008-07-23T14:52:49Z")

</div>

Hola,

You can connect to the Changed event of the class Signal.

> Controller controller = new Controller();
> 
> DigitalSignal doTest = (DigitalSignal)\_controller.IOSystem.GetSignal(“DO\_TEST”);
> 
> \_doTest .Changed += new SignalChangedEventHandler(doTest\_Changed);

The method doTest\_Changed will be called in a different thread that the UI trhead.

Quick notes:

1. Remember to set the Access Level of the Signal to ALL

2. The thread in which your method is called, cannot make any changes in your UI

3. Try not to “hold” the thread for so much time, since this thread might be use for some other events.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 23, 2008, 5:32pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/8 "2008-07-23T17:32:09Z")

</div>

Hi, .. thanks for the insight.. really helps .. btw in your Quick notes no 2 .. you’ve mentioned that " **The thread in which your method is called, cannot make any changes in your UI" ..** did you ment that the method will not update the GUI .. so I better be building a thread wrapper for handling UI issue? anyway .. I’ve just finished writing my own code using my first method .. would it be best if I switch mine method to yours ? .. thanks carlosmtz2000 ..

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [July 23, 2008, 6:40pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/9 "2008-07-23T18:40:28Z")

</div>

Hola de nuevo (hi again),

If you are running in a thread that is not the UI thread, and you try to modify any UI appearance, you will get an exception.

The drawback of your method is that you are polling data all the time; I will recommend use the event mechanism (cheaper and more elegant)

Saludos/Carlos

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [July 23, 2008, 7:15pm UTC](https://tech-community.robotics.abb.com/t/multitasking-apps-with-rab/2023/10 "2008-07-23T19:15:12Z")

</div>

thanks. .. you’re right .. I recheck my code with simultanous tests .. I have an deadlock issues .. what a waste .. I’ll change them out right the way .. thanks again ..
