Functions

gs_cancel.c File Reference

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

Go to the source code of this file.

Functions

IDL_VPTR gs_cancel (int argc, IDL_VPTR *argv_idl)

Function Documentation

IDL_VPTR gs_cancel ( int  argc,
IDL_VPTR *  argv_idl 
)

The implementation of the gs_cancel() call. This cancels a previously submitted non-blocking request.

This is part of the IDL Client for GridSolve. GridRPC cancel 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 cancel.
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_cancel.c.

                                        {
  grpc_error_t ret;
  int req_id;

  IDL_ENSURE_SCALAR(argv_idl[0]);

  req_id = IDL_LongScalar(argv_idl[0]);

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

  IDL_TimerBlock(IDL_TRUE);
  ret = (int) grpc_cancel((grpc_sessionid_t) req_id);
  IDL_TimerBlock(IDL_FALSE);

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

  return IDL_GettmpLong(ret);
}

Here is the call graph for this function: