Tweaks to parallel construction tools.
This commit is contained in:
parent
5a7e54125b
commit
bc0450631f
3 changed files with 23 additions and 18 deletions
|
@ -45,7 +45,7 @@ int make_socket (char *host, unsigned short int port) {
|
||||||
{
|
{
|
||||||
close(sock);
|
close(sock);
|
||||||
perror("Cannot connect to stream socket");
|
perror("Cannot connect to stream socket");
|
||||||
exit(-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sock;
|
return sock;
|
||||||
|
@ -59,7 +59,10 @@ long int get_next_task( const string& host, int port ) {
|
||||||
fd_set ready;
|
fd_set ready;
|
||||||
char message[256];
|
char message[256];
|
||||||
|
|
||||||
sock = make_socket( host.c_str(), port );
|
while ( (sock = make_socket( host.c_str(), port )) < 0 ) {
|
||||||
|
// loop till we get a socket connection
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
// build a command string from the argv[]'s
|
// build a command string from the argv[]'s
|
||||||
strcpy(message, "hello world!\n");
|
strcpy(message, "hello world!\n");
|
||||||
|
@ -115,8 +118,10 @@ main(int argc, char *argv[]) {
|
||||||
string host = argv[1];
|
string host = argv[1];
|
||||||
int port = atoi( argv[2] );
|
int port = atoi( argv[2] );
|
||||||
|
|
||||||
while ( true ) {
|
while (
|
||||||
tile = get_next_task( host, port );
|
(tile = get_next_task( host, port )) >= 0
|
||||||
|
)
|
||||||
|
{
|
||||||
run_task( tile );
|
run_task( tile );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ long int get_next_tile( const string& work_base, const string& output_base )
|
||||||
}
|
}
|
||||||
|
|
||||||
b = FGBucket( lon, lat );
|
b = FGBucket( lon, lat );
|
||||||
cout << "Bucket = " << b << endl;
|
cout << "Bucket = " << b << " (" << pass << ")" << endl;
|
||||||
|
|
||||||
// increment to next tile
|
// increment to next tile
|
||||||
FGBucket tmp( 0.0, lat );
|
FGBucket tmp( 0.0, lat );
|
||||||
|
@ -203,7 +203,7 @@ int main( int argc, char **argv ) {
|
||||||
cout << "socket is connected to port = " << port << endl;
|
cout << "socket is connected to port = " << port << endl;
|
||||||
|
|
||||||
// Specify the maximum length of the connection queue
|
// Specify the maximum length of the connection queue
|
||||||
listen(sock, 3);
|
listen(sock, 10);
|
||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
FD_ZERO(&ready);
|
FD_ZERO(&ready);
|
||||||
|
@ -217,7 +217,7 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
// get the next tile to work on
|
// get the next tile to work on
|
||||||
next_tile = get_next_tile(work_base, output_base);
|
next_tile = get_next_tile(work_base, output_base);
|
||||||
cout << "next tile = " << next_tile << endl;;
|
// cout << "next tile = " << next_tile << endl;;
|
||||||
|
|
||||||
msgsock = accept(sock, 0, 0);
|
msgsock = accept(sock, 0, 0);
|
||||||
// cout << "msgsock = " << msgsock << endl;
|
// cout << "msgsock = " << msgsock << endl;
|
||||||
|
|
|
@ -39,17 +39,17 @@ enum AreaType {
|
||||||
SomeSortOfArea = 0,
|
SomeSortOfArea = 0,
|
||||||
AirportKeepArea = 1,
|
AirportKeepArea = 1,
|
||||||
AirportIgnoreArea = 2,
|
AirportIgnoreArea = 2,
|
||||||
OceanArea = 3,
|
LakeArea = 3,
|
||||||
LakeArea = 4,
|
DryLakeArea = 4,
|
||||||
DryLakeArea = 5,
|
IntLakeArea = 5,
|
||||||
IntLakeArea = 6,
|
ReservoirArea = 6,
|
||||||
ReservoirArea = 7,
|
IntReservoirArea = 7,
|
||||||
IntReservoirArea = 8,
|
StreamArea = 8,
|
||||||
StreamArea = 9,
|
CanalArea = 9,
|
||||||
CanalArea = 10,
|
GlacierArea = 10,
|
||||||
GlacierArea = 11,
|
MarshArea = 11,
|
||||||
MarshArea = 12,
|
DefaultArea = 12,
|
||||||
DefaultArea = 13,
|
OceanArea = 13,
|
||||||
VoidArea = 9997,
|
VoidArea = 9997,
|
||||||
NullArea = 9998,
|
NullArea = 9998,
|
||||||
UnknownArea = 9999
|
UnknownArea = 9999
|
||||||
|
|
Loading…
Reference in a new issue