00001 #ifndef THREADEXEC_H 00002 #define THREADEXEC_H 00003 00004 00005 // Construct command arguments, exec a background function with 00006 // command line arguments, and wait for it. 00007 00008 00009 00010 // The reason we do this is that execvp and threading don't work together. 00011 00012 #include "bcwindowbase.inc" 00013 #include "mutex.inc" 00014 #include "thread.h" 00015 #include <stdio.h> 00016 00017 00018 class ThreadExec : public Thread 00019 { 00020 public: 00021 ThreadExec(); 00022 virtual ~ThreadExec(); 00023 00024 FILE* get_stdin(); 00025 void run(); 00026 void start_command(char *command_line, int pipe_stdin); 00027 virtual void run_program(int argc, char *argv[], int stdin_fd); 00028 00029 00030 private: 00031 int filedes[2]; 00032 char **arguments; 00033 char path[BCTEXTLEN]; 00034 int total_arguments; 00035 FILE *stdin_fd; 00036 Mutex *start_lock; 00037 char *command_line; 00038 int pipe_stdin; 00039 }; 00040 00041 00042 00043 00044 #endif
1.4.4