r602: Fix baver's code... don't insert timecode when show_tc is not set
[cinelerra_cv/mob.git] / cinelerra / loadbalance.h
blobe654ef961cd76a885529e15286e1210103a7f3a9
1 #ifndef LOADBALANCE_H
2 #define LOADBALANCE_H
4 #include "condition.inc"
5 #include "mutex.inc"
6 #include "thread.h"
11 // Load balancing utils
12 // There is no guarantee that all the load clients will be run in a
13 // processing operation.
16 class LoadServer;
20 class LoadPackage
22 public:
23 LoadPackage();
24 virtual ~LoadPackage();
26 Condition *completion_lock;
27 // Range to search in the total scan area
28 int pixel1, pixel2;
32 class LoadClient : public Thread
34 public:
35 LoadClient(LoadServer *server);
36 virtual ~LoadClient();
38 void run();
39 virtual void process_package(LoadPackage *package) {};
40 int get_package_number();
41 LoadServer* get_server();
43 int done;
44 int package_number;
45 Condition *input_lock;
46 Condition *completion_lock;
47 LoadServer *server;
53 class LoadServer
55 public:
56 LoadServer(int total_clients, int total_packages);
57 virtual ~LoadServer();
59 friend class LoadClient;
61 // Called first in process_packages. Should also initialize clients.
62 virtual void init_packages() {};
63 virtual LoadClient* new_client() { return 0; };
64 virtual LoadPackage* new_package() { return 0; };
66 // User calls this to do an iteration
67 void process_packages();
70 int get_total_packages();
71 int get_total_clients();
72 LoadPackage* get_package(int number);
73 LoadClient* get_client(int number);
74 void set_package_count(int total_packages);
78 void delete_clients();
79 void create_clients();
80 void delete_packages();
81 void create_packages();
87 int current_package;
88 LoadPackage **packages;
89 int total_packages;
90 LoadClient **clients;
91 int total_clients;
92 Mutex *client_lock;
97 #endif