Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

trttask.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include "trttask.h"
00012 #include "trtos.h"
00013 #include "trt.h"
00014 #include <assert.h>
00015 
00016 trtTask::trtTask(void (*f)(void*),void *a, int s) :
00017   func(f), 
00018   args(a),
00019   stackSize(s)
00020 {
00021 }
00022 
00023 trtTask::~trtTask()
00024 {
00025 //  assert(!pr);
00026 }
00027 
00028 int run_trt_task(int args)
00029 {
00030   trtTask* task = (trtTask*)args;
00031   task->func(task->args);
00032 }
00033 
00034 void trtTask::start()
00035 {
00036   thr_create(&pr, run_trt_task, (int)this);
00037   thr_set_name(&pr, "pamTask");
00038   thr_stack_size(&pr, stackSize);
00039   thr_start(&pr);
00040 }
00041 
00042 void trtTask::exit()
00043 {
00044 //  assert(pr);
00045 //  pr = 0;
00046   thr_exit(0);
00047 }
00048 
00049 void trtTask::join()
00050 {
00051   thr_join(&pr, NULL);
00052 }
00053 
00054 void trtTask::kill()
00055 {
00056 //  if (pr)
00057 //  {
00058     thr_suspend(&pr);
00059     thr_destroy(&pr);
00060 //    pr = 0;
00061 //  }
00062 }
00063 

Generated on Wed Feb 15 14:52:39 2006 for yapi by doxygen 1.3.2