1
0
Fork 0

Tweaks to parallel construction tools.

This commit is contained in:
curt 1999-05-17 17:43:52 +00:00
parent 5a7e54125b
commit bc0450631f
3 changed files with 23 additions and 18 deletions

View file

@ -45,7 +45,7 @@ int make_socket (char *host, unsigned short int port) {
{
close(sock);
perror("Cannot connect to stream socket");
exit(-1);
return -1;
}
return sock;
@ -59,7 +59,10 @@ long int get_next_task( const string& host, int port ) {
fd_set ready;
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
strcpy(message, "hello world!\n");
@ -115,8 +118,10 @@ main(int argc, char *argv[]) {
string host = argv[1];
int port = atoi( argv[2] );
while ( true ) {
tile = get_next_task( host, port );
while (
(tile = get_next_task( host, port )) >= 0
)
{
run_task( tile );
}
}

View file

@ -160,7 +160,7 @@ long int get_next_tile( const string& work_base, const string& output_base )
}
b = FGBucket( lon, lat );
cout << "Bucket = " << b << endl;
cout << "Bucket = " << b << " (" << pass << ")" << endl;
// increment to next tile
FGBucket tmp( 0.0, lat );
@ -203,7 +203,7 @@ int main( int argc, char **argv ) {
cout << "socket is connected to port = " << port << endl;
// Specify the maximum length of the connection queue
listen(sock, 3);
listen(sock, 10);
for ( ;; ) {
FD_ZERO(&ready);
@ -217,7 +217,7 @@ int main( int argc, char **argv ) {
// get the next tile to work on
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);
// cout << "msgsock = " << msgsock << endl;

View file

@ -39,17 +39,17 @@ enum AreaType {
SomeSortOfArea = 0,
AirportKeepArea = 1,
AirportIgnoreArea = 2,
OceanArea = 3,
LakeArea = 4,
DryLakeArea = 5,
IntLakeArea = 6,
ReservoirArea = 7,
IntReservoirArea = 8,
StreamArea = 9,
CanalArea = 10,
GlacierArea = 11,
MarshArea = 12,
DefaultArea = 13,
LakeArea = 3,
DryLakeArea = 4,
IntLakeArea = 5,
ReservoirArea = 6,
IntReservoirArea = 7,
StreamArea = 8,
CanalArea = 9,
GlacierArea = 10,
MarshArea = 11,
DefaultArea = 12,
OceanArea = 13,
VoidArea = 9997,
NullArea = 9998,
UnknownArea = 9999