Skip to content
Snippets Groups Projects
Commit f3eb1685 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

tiny cleanup
parent a6ac7097
Branches
Tags
No related merge requests found
/* $Id: GmshServer.cpp,v 1.25 2005-01-08 20:15:11 geuzaine Exp $ */ /* $Id: GmshServer.cpp,v 1.26 2005-01-14 04:50:48 geuzaine Exp $ */
/* /*
* Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle * Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
* *
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
* Christopher Stott * Christopher Stott
*/ */
// This is a hacked version using the Gmsh function SystemCall()
// instead system() and using CTX.solver.max_delay in select()
#include "Context.h"
extern Context_T CTX;
void SystemCall(char *str); void SystemCall(char *str);
#include <stdio.h> #include <stdio.h>
...@@ -85,7 +81,7 @@ static int Socket_UnlinkName(char *name) ...@@ -85,7 +81,7 @@ static int Socket_UnlinkName(char *name)
/* public interface */ /* public interface */
int Gmsh_StartClient(char *command, char *sockname) int Gmsh_StartClient(char *command, char *sockname, int maxdelay)
{ {
static int init = 0; static int init = 0;
static int s; static int s;
...@@ -104,8 +100,7 @@ int Gmsh_StartClient(char *command, char *sockname) ...@@ -104,8 +100,7 @@ int Gmsh_StartClient(char *command, char *sockname)
/* no socket? launch the command! */ /* no socket? launch the command! */
if(!sockname) { if(!sockname) {
//system(command); SystemCall(command); //system(command);
SystemCall(command);
return 1; return 1;
} }
...@@ -160,16 +155,14 @@ int Gmsh_StartClient(char *command, char *sockname) ...@@ -160,16 +155,14 @@ int Gmsh_StartClient(char *command, char *sockname)
} }
/* Start the external function via system() call */ /* Start the external function via system() call */
//system(command); SystemCall(command); //system(command);
SystemCall(command);
/* wait for external function to connect */ /* wait for external function to connect */
if(listen(s, 20)) if(listen(s, 20))
return -3; /* Error: Socket listen failed */ return -3; /* Error: Socket listen failed */
/* Watch s to see when it has input; wait up to N seconds */ /* Watch s to see when it has input; wait up to N seconds */
//tv.tv_sec = 4; tv.tv_sec = maxdelay;
tv.tv_sec = CTX.solver.max_delay;
tv.tv_usec = 0; tv.tv_usec = 0;
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(s, &rfds); FD_SET(s, &rfds);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* Please report all bugs and problems to <gmsh@geuz.org>. * Please report all bugs and problems to <gmsh@geuz.org>.
*/ */
int Gmsh_StartClient(char *command, char *sockname); int Gmsh_StartClient(char *command, char *sockname, int maxdelay);
int Gmsh_ReceiveString(int socket, int *type, char str[]); int Gmsh_ReceiveString(int socket, int *type, char str[]);
int Gmsh_StopClient(char *sockname, int socket); int Gmsh_StopClient(char *sockname, int socket);
......
# $Id: Makefile,v 1.67 2005-01-13 23:39:10 geuzaine Exp $ # $Id: Makefile,v 1.68 2005-01-14 04:50:48 geuzaine Exp $
# #
# Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle # Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
# #
...@@ -150,7 +150,7 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \ ...@@ -150,7 +150,7 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
../Common/VertexArray.h ../Common/SmoothNormals.h ../Mesh/Metric.h \ ../Common/VertexArray.h ../Common/SmoothNormals.h ../Mesh/Metric.h \
../Mesh/Matrix.h Colorbar_Window.h ../Common/ColorTable.h \ ../Mesh/Matrix.h Colorbar_Window.h ../Common/ColorTable.h \
../Common/Context.h ../Common/Context.h
GmshServer.o: GmshServer.cpp ../Common/Context.h ../DataStr/List.h GmshServer.o: GmshServer.cpp
Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \ Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
../DataStr/avl.h ../DataStr/Tools.h GmshServer.h ../Parser/OpenFile.h \ ../DataStr/avl.h ../DataStr/Tools.h GmshServer.h ../Parser/OpenFile.h \
......
// $Id: Solvers.cpp,v 1.33 2005-01-14 01:40:49 geuzaine Exp $ // $Id: Solvers.cpp,v 1.34 2005-01-14 04:50:48 geuzaine Exp $
// //
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
// //
...@@ -70,7 +70,7 @@ int Solver(int num, char *args) ...@@ -70,7 +70,7 @@ int Solver(int num, char *args)
#if !defined(WIN32) #if !defined(WIN32)
strcat(command, " &"); strcat(command, " &");
#endif #endif
Gmsh_StartClient(command, NULL); Gmsh_StartClient(command, NULL, CTX.solver.max_delay);
return 1; return 1;
} }
...@@ -90,7 +90,7 @@ int Solver(int num, char *args) ...@@ -90,7 +90,7 @@ int Solver(int num, char *args)
strcat(command, " &"); strcat(command, " &");
#endif #endif
sock = Gmsh_StartClient(command, socket_name); sock = Gmsh_StartClient(command, socket_name, CTX.solver.max_delay);
if(sock < 0) { if(sock < 0) {
switch (sock) { switch (sock) {
case -1: case -1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment