00001 00002 // Copyright (c) 2005, 2006 Yigong Liu 00003 // Permission to use, copy, modify, distribute and sell this software for any 00004 // purpose is hereby granted without fee, provided that the above copyright 00005 // notice appear in all copies and that both that copyright notice and this 00006 // permission notice appear in supporting documentation. 00007 // The author makes no representations about the 00008 // suitability of this software for any purpose. It is provided "as is" 00009 // without express or implied warranty. 00011 00012 //--------------------------------------------------------- 00013 // 00014 // a demo application task: 00015 // inherited from Task and implement the following methods: 00016 // prepare() - preparation before app thread start, such 00017 // as registry for msgs, que, open files... 00018 // work() - main processing loop, call recv_msg to get app 00019 // msgs 00020 // cleanup() - called right before app thread exits, such 00021 // as unreg for msgs, ques, close files.... 00022 // 00023 // this task will be built as a shared lib and dynamically linked 00024 // into runtime (main) thru conf file 00025 // 00026 //--------------------------------------------------------- 00027 00028 #include <Cvm.h> 00029 00030 using namespace channel; 00031 using namespace cvm; 00032 00033 class Pong_Task : public CvmTask { 00034 public: 00035 //Each app should implement the following 3 methods 00036 //to get app control flow going 00037 Status prepare(void); //initialization before thread starts 00038 Status cleanup(void); //cleanup before threads exit 00039 int work (void); //main processing loop 00040 void send_ping_pong(void); 00041 }; 00042 00043