NXC: wait(1) for safe task (scheduling) control needed?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by mattallen37 »

doc-helmut wrote:...So again my question:
MUST I FOR SURE insert at least a Wait(1) to ALL task loops (also to the very fast ones) for a safe scheduling or not ?
I don't always. Normally, I have my tasks completely independent of each other (no mutexes). Normally, my tasks consist of a while(true) loop, and I don't always have a wait in the loops. IIRC, I have never experienced any issues with this method.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by HaWe »

thx, matt + Xander!
- any other observations about that issue ("MUST I - or not)?

ps:- but now it's supposed to be VERY EARLY in Michigan, isn't it? ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by mattallen37 »

doc-helmut wrote:thx, matt + Xander!
- any other observations about that issue ("MUST I - or not)?

ps:- but now it's supposed to be VERY EARLY in Michigan, isn't it? ;)
You're welcome.

It is about 4:30 am, so a few hours before sunrise. My dad will probably be getting up soon. Normally, I go to bed half an hour or an hour after he gets up.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by muntoo »

John did once say that it is a good idea to use Yield(), but he may have changed the firmware so this is not necessary anymore, and Yield() is just an "artifact" from the stone age of NXC :).

(Currently, we're in the extremely high-tech middle ages. :D)
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by HaWe »

my question was not about "a good idea" but about a definite answer to "unnecessarily needed or not"
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by muntoo »

doc-helmut wrote:my question was not about "a good idea" but about a definite answer to "unnecessarily needed or not"
Probably not needed with the new EFs, but we'll need John Hansen to confirm this.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by HaWe »

well, "probably" is not the answer that I was looking for...
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by mattallen37 »

I don't think it is. Why don't you just try an example program, and see for yourself? Write a program that uses several tasks at the same time, and don't use waits. See what happens. I don't think the NXT will explode if it doesn't work.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by HaWe »

I can't test it in the environment in which I actually need to have it - in my case it's the 14-20 task subsumption program. I will never know if 1 ppm of the BT communications and/or I2C sensor readings and/or priority calculations are faulty or not if I sacrifice all the Wait(1) in all tasks.
But Xander's reply appears to me to be the most confident one so far.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: wait(1) for safe task (scheduling) control needed?

Post by mattallen37 »

Well, that is why I recommended a test program. Often, I write a program just to test a single function or concept.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests