To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 497
496  |  498
Subject: 
Re: Two motors at the same time... It is possible?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Mon, 19 Feb 2007 02:40:51 GMT
Viewed: 
13197 times
  
In lugnet.robotics.nxt, Johan Strandberg wrote:
In this case you have two threads running concurrently which both call
into the same subroutine.  That's a recipe for disaster.  Exactly what
will happen when two threads simultaneously call the same subroutine
is undefined.

So, maybe a large red label warning saying "threads may not call the
same subroutine simultaneously"?

Or maybe just wrap the calls inside a mutex, so at least the behaviour is
defined, if not optimum. Many of the NBC/NXC macros do exactly that, maybe all
of them should?

ROSCO



Message is in Reply To:
  Re: Two motors at the same time... It is possible?
 
(...) I understand his confusion. Not allowing separate threads to call the same subroutine is certainly unexpected. The concept of "thread" conventionally involves separate stacks for local variables (and a shared global state -- unlike separate (...) (18 years ago, 19-Feb-07, to lugnet.robotics.nxt)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR