Functions

gs_wait.c File Reference

#include <stdio.h>
#include "idl_export.h"
#include "grpc.h"
#include "idl_request.h"
Include dependency graph for gs_wait.c:

Go to the source code of this file.

Functions

IDL_VPTR gs_wait (int argc, IDL_VPTR *argv_idl)

Function Documentation

IDL_VPTR gs_wait ( int  argc,
IDL_VPTR *  argv_idl 
)

Implementation of gs_wait(). This waits for the specified job to complete and downloads the results.

This is part of the IDL Client for GridSolve. GridRPC wait call

Parameters:
argc -- the number of arguments
argv_idl -- the array of IDL arguments passed in this should contain one argument: the request ID of the job to wait for.
Returns:
an IDL variable containing the GridRPC exit status of the call. See the GridRPC documentation for details.

Definition at line 29 of file gs_wait.c.

{
  grpc_function_handle_t *handle = NULL;
  grpc_error_t info;
  int req_id;

  IDL_ENSURE_SCALAR(argv_idl[0]);

  req_id = IDL_LongScalar(argv_idl[0]);

  /* Initialize GridRPC system */
  info = grpc_initialize(NULL);
  if((info != GRPC_NO_ERROR) && (info != GRPC_ALREADY_INITIALIZED)) {
    IDL_Message(IDL_M_GENERIC, IDL_MSG_INFO, "Error: cannot initialize!");
    return IDL_GettmpLong((int)info);
  }

  IDL_TimerBlock(IDL_TRUE);

  /* must be before grpc_wait(). */
  if(grpc_get_handle(&handle, req_id) != GRPC_NO_ERROR)
    IDL_Message(IDL_M_GENERIC,IDL_MSG_INFO,
         "Warning: gs_wait() cannot get function handle!");

  info = grpc_wait(req_id);

  IDL_TimerBlock(IDL_FALSE);

  if(info == GRPC_NO_ERROR)
    del_req(req_id);    

  if(handle) {
    grpc_function_handle_destruct(handle);
    free(handle);
  }

  return IDL_GettmpLong((int)info);
}

Here is the call graph for this function: