- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Rtapi/MultiThreadedObject.h

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #if !defined(AFX_MULTITHREADEDOBJECT_H__26379F5B_12D2_4331_A262_FDBA6AEC5D91__INCLUDED_)
    00015 #define AFX_MULTITHREADEDOBJECT_H__26379F5B_12D2_4331_A262_FDBA6AEC5D91__INCLUDED_
    00016
    00017 #if _MSC_VER > 1000
    00018 #pragma once
    00019 #endif // _MSC_VER > 1000
    00020
    00021 #include <pthread.h>
    00022
    00023 namespace Mers {
    00024         namespace Executives {
    00025                 namespace DeductiveController {
    00026                         namespace Rtapi {
    00027
    00035                                 class MultiThreadedObject
    00036                                 {
    00037                                 public:
    00038                                         //-----------------------------------------
    00039                                         // Constructors
    00040                                         //-----------------------------------------
    00041
    00045                                         MultiThreadedObject();
    00046
    00047                                         //-----------------------------------------
    00048                                         // Destructors
    00049                                         //-----------------------------------------
    00050
    00055                                         virtual ~MultiThreadedObject();
    00056
    00057                                         //-----------------------------------------
    00058                                         // Functions
    00059                                         //-----------------------------------------
    00060
    00066                                         int start();
    00073                                         int stop();
    00074
    00075                                 protected:
    00082                                         virtual void * run() = 0;
    00083
    00084                                 private:
    00090                                         static void * runCallback(void * thisCallback);
    00091
    00092                                 protected:
    00095                                         bool m_ThreadIsRunning;
    00096
    00098                                         pthread_t m_Thread;
    00099
    00102                                         pthread_attr_t m_ThreadAttributes;
    00103                                 };
    00104                         }
    00105                 }
    00106         }
    00107 }
    00108
    00109 #endif // !defined(AFX_MULTITHREADEDOBJECT_H__26379F5B_12D2_4331_A262_FDBA6AEC5D91__INCLUDED_)