Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Improved timeout logic in quartzplugin

See merge request Scientific-IT-Systems/gr!133
  • Loading branch information
jheinen committed Feb 13, 2019
2 parents e3ca355 + 41b44a6 commit fb451b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/gks/plugin/quartzplugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ DLLEXPORT void gks_quartzplugin(int fctid, int dx, int dy, int dimx, int *i_arr,
#endif

#define GKSTERM_DEFAULT_TIMEOUT 5000

static int gksterm_has_run_before = 0;
/* Timeout for is running is short so that GKSTerm will be started quickly. */
#define GKSTERM_IS_RUNNING_TIMEOUT 50
#define GKSTERM_IS_RUNNING_TIMEOUT (gksterm_has_run_before ? 500 : 50)

static gks_state_list_t *gkss;

Expand Down Expand Up @@ -93,7 +95,7 @@ static void gksterm_communicate(const char *request, size_t request_len, int tim
}
if (rc == -1 && errno == EAGAIN)
{
usleep(10000);
usleep(1000);
}
rc = zmq_msg_send(&message, socket, ZMQ_DONTWAIT);
}
Expand All @@ -115,7 +117,7 @@ static void gksterm_communicate(const char *request, size_t request_len, int tim
}
if (rc == -1 && errno == EAGAIN)
{
usleep(10000);
usleep(1000);
}
rc = zmq_msg_recv(&message, socket, ZMQ_DONTWAIT);
}
Expand Down Expand Up @@ -148,6 +150,7 @@ static bool gksterm_is_running()
{
return false;
}
gksterm_has_run_before = 1;
return true;
}

Expand Down

0 comments on commit fb451b2

Please sign in to comment.