4 #include "condition.inc"
11 // Load balancing utils
12 // There is no guarantee that all the load clients will be run in a
13 // processing operation.
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
35 LoadClient(LoadServer
*server
);
37 virtual ~LoadClient();
40 virtual void process_package(LoadPackage
*package
) {};
41 int get_package_number();
42 LoadServer
* get_server();
46 Condition
*input_lock
;
47 Condition
*completion_lock
;
57 LoadServer(int total_clients
, int total_packages
);
58 virtual ~LoadServer();
60 friend class LoadClient
;
62 // Called first in process_packages. Should also initialize clients.
63 virtual void init_packages() {};
64 virtual LoadClient
* new_client() { return 0; };
65 virtual LoadPackage
* new_package() { return 0; };
67 // User calls this to do an iteration
68 void process_packages();
71 int get_total_packages();
72 int get_total_clients();
73 LoadPackage
* get_package(int number
);
74 LoadClient
* get_client(int number
);
75 void set_package_count(int total_packages
);
79 void delete_clients();
80 void create_clients();
81 void delete_packages();
82 void create_packages();
89 LoadPackage
**packages
;