Example #1
0
void	pjostle_init(int *P, int *p)
{	/* pjostle_init: O(1)
	 * initialise the communications for pjostle */
#ifdef MESSAGE_LOG
	char	fname[99];
#endif

	if (gs_initialised) {
		jwarning(0,"pjostle_init already called");
		return;
	} else
		gs_initialised = 1;

	if (*p < 0 || *p >= *P)
		jerror("pid (= %d) < 0 || pid >= nprocs (= %d)",*p,*P);

	jpid = *p;
	j_nprocs = *P;

	original_global_comm = global_comm = MPI_COMM_WORLD;

	if (global_group == NULL) {
		MONITOR(success =) MPI_Comm_group(MPI_COMM_WORLD, &global_group);
		ASSERT(success >= 0);
	}
static int handle_error (sqlite3 *db, chirp_jobid_t id, int rc)
{
	switch (rc) {
		/* no error */
		case 0:
			break;
		/* temporary error. */
		case EAGAIN:
		case EINTR:
			break;
		default:
			jerror(db, id, strerror(rc));
			break;
	}
	return rc;
}
Example #3
0
static void After(uv_fs_t* req) {
  FsReqWrap* req_wrap = static_cast<FsReqWrap*>(req->data);
  IOTJS_ASSERT(req_wrap != NULL);
  IOTJS_ASSERT(req_wrap->data() == req);

  JObject cb = req_wrap->jcallback();
  IOTJS_ASSERT(cb.IsFunction());

  JArgList jarg(2);
  if (req->result < 0) {
    JObject jerror(CreateUVException(req->result, "open"));
    jarg.Add(jerror);
  } else {
    jarg.Add(JObject::Null());
    switch (req->fs_type) {
      case UV_FS_CLOSE:
      {
        break;
      }
      case UV_FS_OPEN:
      case UV_FS_READ:
      case UV_FS_WRITE:
      {
        JObject arg1(static_cast<int>(req->result));
        jarg.Add(arg1);
        break;
      }
      case UV_FS_STAT: {
        uv_stat_t s = (req->statbuf);
        JObject ret(MakeStatObject(&s));
        jarg.Add(ret);
        break;
      }
      default:
        jarg.Add(JObject::Null());
    }
  }

  JObject res = MakeCallback(cb, JObject::Null(), jarg);

  uv_fs_req_cleanup(req);

  delete req_wrap;
}