wefts_proc_pthread.h

Go to the documentation of this file.
00001 /* 00002 wefts_coffee_pthread.h 00003 Cooperative file functions enlarged environment - process management. 00004 00005 $Id: wefts_proc_pthread.h,v 1.1 2004/03/28 08:28:10 jonnymind Exp $ 00006 --------------------------------------------- 00007 Begin : 2003-08-15 16:30 00008 Author : Giancarlo Niccolai 00009 00010 Last modified because: 00011 00012 */ 00013 00014 /************************************************************************** 00015 * This program is free software; you can redistribute it and/or modify * 00016 * it under the terms of the GNU Library General Public License as * 00017 * published by the Free Software Foundation; either version 2.1 of the * 00018 * License, or (at your option) any later version. * 00019 ***************************************************************************/ 00020 00021 00022 #ifndef WT_PROC_PTHREAD_H 00023 #define WT_PROC_PTHREAD_H 00024 00025 #include <pthread.h> 00026 #include <wefts_coffee_base.h> 00027 00028 namespace Wefts 00029 { 00030 00041 class OSProcessPthread: public OSProcessBase 00042 { 00043 pthread_mutex_t m_mutex; 00044 pid_t m_pid; 00045 00046 int m_childIn, m_childOut, m_childErr; 00047 bool m_sinkIn, m_sinkOut, m_sinkErr; 00048 00049 void detachUnlocked(); 00050 00051 static int parametrize( char *dese, const char *src ); 00052 static char ** argvize( char *dest, int size ); 00053 public: 00054 00055 OSProcessPthread(); 00056 ~OSProcessPthread(); 00057 00058 virtual bool running(); 00059 virtual bool wait( const double seconds=-1.0 ); 00060 virtual bool start( const std::string process, bool useShell=false, bool usePath=true ); 00061 virtual bool stop(); 00062 virtual bool getProcessValue( int &retvalue ) const; 00063 virtual file_size_t getProcessId() const; 00064 virtual int write( const void *data, const int size, const double seconds=-1.0 ); 00065 virtual int read( void *data, const int size, const double seconds=-1.0 ); 00066 virtual int readStdErr( void *data, const int size, const double seconds=-1.0 ); 00067 virtual void mergeStdErr(); 00068 virtual void detach(); 00069 00070 virtual void sinkInput(); 00071 virtual void sinkOutput(); 00072 virtual void sinkError(); 00073 00074 virtual bool closeRead(); 00075 virtual bool closeWrite(); 00076 virtual bool closeStdErr(); 00077 virtual void handleCleanup( int code, void *caller=0 ); 00078 }; 00079 00080 typedef OSProcessPthread Process; 00081 00082 } 00083 #endif 00084 00085 /* end of wefts_proc_pthread.h */

Generated on Tue Oct 5 14:57:00 2004 for Wefts by doxygen 1.3.7