gs_cancel.c

Go to the documentation of this file.
00001 
00007 /* $Id: gs_cancel.c,v 1.4 2007/03/01 22:52:31 seymour Exp $ */
00008 /* $UTK_Copyright: $ */
00009 
00010 
00011 #include <stdio.h>
00012 #include "idl_export.h"
00013 #include "idl_request.h"
00014 #include "grpc.h"
00015 
00028 IDL_VPTR
00029 gs_cancel(int argc, IDL_VPTR* argv_idl) {
00030   grpc_error_t ret;
00031   int req_id;
00032 
00033   IDL_ENSURE_SCALAR(argv_idl[0]);
00034 
00035   req_id = IDL_LongScalar(argv_idl[0]);
00036 
00037   /* Initialize GridRPC system */
00038   ret = grpc_initialize(NULL);
00039   if((ret != GRPC_NO_ERROR) && (ret != GRPC_ALREADY_INITIALIZED)) {
00040     IDL_Message(IDL_M_GENERIC, IDL_MSG_INFO, "Error: cannot initialize!");
00041     return IDL_GettmpLong(ret);
00042   }
00043 
00044   IDL_TimerBlock(IDL_TRUE);
00045   ret = (int) grpc_cancel((grpc_sessionid_t) req_id);
00046   IDL_TimerBlock(IDL_FALSE);
00047 
00048   if(ret == GRPC_NO_ERROR)
00049     del_req(req_id);    
00050 
00051   return IDL_GettmpLong(ret);
00052 }