00001
00002 #ifndef INCLUDED_FreezeTestBehavior_h_
00003 #define INCLUDED_FreezeTestBehavior_h_
00004
00005 #include "Behaviors/BehaviorBase.h"
00006 #include "Wireless/Wireless.h"
00007
00008
00009 class FreezeTestBehavior : public BehaviorBase {
00010 public:
00011 FreezeTestBehavior() : BehaviorBase("FreezeTestBehavior") {}
00012
00013 virtual void DoStart() {
00014
00015 BehaviorBase::DoStart();
00016
00017
00018 const unsigned int start=2500001;
00019 serr->printf("Now computing all primes greater than %d... (this might take... forever)\n",start-1);
00020 serr->printf("Motion process should be able to continue, but Main process will freeze.\n");
00021 for(unsigned int i=start;;i+=2) {
00022 unsigned int j=3;
00023 const unsigned int irt=(unsigned int)sqrt((double)i);
00024 for(; j<=irt; j++)
00025 if((i/j)*j==i)
00026 break;
00027 if(j==irt)
00028 serr->printf("%d is prime\n",i);
00029 }
00030
00031 }
00032
00033 static std::string getClassDescription() {
00034
00035 return "A little demo of a Main process infinite loop freeze (yes, this hangs the AIBO)";
00036 }
00037 virtual std::string getDescription() const { return getClassDescription(); }
00038 };
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #endif