initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / threadfork.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef THREADFORK_H
23 #define THREADFORK_H
24
25
26 // Construct command arguments, fork a background process and wait for it.
27
28 #include <stdio.h>
29 #include <stdint.h>
30 #include <pthread.h>
31
32 #include "bcwindowbase.inc"
33
34 class ThreadFork
35 {
36 public:
37         ThreadFork();
38         ~ThreadFork();
39         
40         FILE* get_stdin();
41         void run();
42         void start_command(const char *command_line, int pipe_stdin);
43         
44         static void* entrypoint(void *ptr);
45         
46 private:
47         int filedes[2];
48         int pid;
49         pthread_t tid;
50         char **arguments;
51         char path[BCTEXTLEN];
52         int total_arguments;
53         FILE *stdin_fd;
54         pthread_mutex_t start_lock;
55         const char *command_line;
56         int pipe_stdin;
57 };
58
59
60
61
62 #endif