00001 #ifndef THREADFORK_H 00002 #define THREADFORK_H 00003 00004 00005 // Construct command arguments, fork a background process and wait for it. 00006 00007 #include "bcwindowbase.inc" 00008 #include <pthread.h> 00009 #include <stdio.h> 00010 00011 class ThreadFork 00012 { 00013 public: 00014 ThreadFork(); 00015 ~ThreadFork(); 00016 00017 FILE* get_stdin(); 00018 void run(); 00019 void start_command(char *command_line, int pipe_stdin); 00020 00021 static void* entrypoint(void *ptr); 00022 00023 private: 00024 int filedes[2]; 00025 int pid; 00026 pthread_t tid; 00027 char **arguments; 00028 char path[BCTEXTLEN]; 00029 int total_arguments; 00030 FILE *stdin_fd; 00031 pthread_mutex_t start_lock; 00032 char *command_line; 00033 int pipe_stdin; 00034 }; 00035 00036 00037 00038 00039 #endif
1.4.4