Thread: Threading
View Single Post
  #9   Spotlight this post!  
Unread 01-02-2009, 17:58
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Threading

Chief Pride,

I can see two small problems with your code, both of which are very easy to fix. The first:

Quote:
Originally Posted by Chief Pride View Post
Code:
		CameraThread("camera_thread", imageProcessThread())
When you pass a function as an argument, you don't use parenthesis after the thread - parenthesis indicate a function call, not the function itself. So it should be just
Code:
CameraThread("camera_thread", imageProcessThread)
Secondly, your task function (imageProcessThread) must be declared outside any class definition. So move it after the class ends and before START_ROBOT_CLASS.
You may also have to put a "prototype" of your function before your class definition to make the compiler happy, like so:

Code:
int imageProcessThread(...); /* prototype */

class Robot : public SimpleRobot {
  // ...
};

int imageProcessThread(...)
{
   return 1;
}

START_ROBOT_CLASS(SimpleRobot);
Good luck and let me know if you have any more trouble.
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
Reply With Quote