Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

tests/debug_test.cpp

Go to the documentation of this file.
00001 
00010 //if object has template functions, include the .cpp
00011 //else, include the .h
00012 #include <pthread.h>
00013 #include <unistd.h>
00014 #include <assert.h>
00015 #include "core/debug.cpp"
00016 #include "core/thread.cpp"
00017 #include "mem/memory.cpp"
00018 #include "mem/alloc.cpp"
00019 
00020 //using namespace std ;
00025 class myThread : public Thread
00026 {
00027     public:
00029         myThread()
00030         {
00031             Thread();
00032         }
00034         ~myThread()
00035         {
00036             pthread_exit(0);
00037         }
00039         void Setup()
00040         {
00041         }
00042         
00044         void Execute(void *arg)
00045         {
00046             {assert(arg != NULL);}
00047             char *t = (char *) arg;
00048             debug2_("argument passed to thread", *t, LOG_NO);//cout << *t << std::endl;
00049         }
00050 };
00051 
00052 int main(void)
00053 {
00054     myThread *th_test;
00055     int i = 2;
00056     char *j;
00057     agent_new(&j);
00058     *j = 'a';
00059     debug2_("i", i, LOG_NO);
00060     debug2_("j", *j, LOG_NO);
00061     agent_zap(j);
00062     agent_malloc(&j, sizeof(char));
00063     *j = 'b';
00064     debug2_("j after malloc", *j, LOG_NO);
00065 
00066     agent_println("creating thread");
00067     agent_new(&th_test);
00068     th_test->Start(j);
00069     agent_println("destroying thread");
00070     agent_free((void *)j);
00071     agent_zap(th_test);
00072     return 0;
00073 }

Generated at Thu May 30 15:12:33 2002 for Freeagent by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001