int remove_alps_reservation(
    
  char *rsv_id)

  {
  int               index;
  int               rc = PBSE_NONE;
  alps_reservation *ar = NULL;

  pthread_mutex_lock(alps_reservations.rh_mutex);
  if ((index = get_value_hash(alps_reservations.rh_ht, rsv_id)) < 0)
    rc = THING_NOT_FOUND;
  else
    {
    ar = (alps_reservation *)alps_reservations.rh_alps_rsvs->slots[index].item;
    remove_thing_from_index(alps_reservations.rh_alps_rsvs, index);
    remove_hash(alps_reservations.rh_ht, rsv_id);
    }
  pthread_mutex_unlock(alps_reservations.rh_mutex);

  if (ar != NULL)
    free_alps_reservation(ar);

  return(rc);
  } /* END remove_alps_reservation() */
Esempio n. 2
0
int remove_queue(

  all_queues *aq,
  pbs_queue  *pque)

  {
  int  rc = PBSE_NONE;
  int  index;
  char log_buf[1000];

  if (pthread_mutex_trylock(aq->allques_mutex))
    {
    unlock_queue(pque, __func__, NULL, LOGLEVEL);
    lock_allques_mutex(aq, __func__, "1", LOGLEVEL);
    lock_queue(pque, __func__, NULL, LOGLEVEL);
    }

  if ((index = get_value_hash(aq->ht,pque->qu_qs.qu_name)) < 0)
    rc = THING_NOT_FOUND;
  else
    {
    remove_thing_from_index(aq->ra,index);
    remove_hash(aq->ht,pque->qu_qs.qu_name);
    }

  snprintf(log_buf, sizeof(log_buf), "index = %d, name = %s", index, pque->qu_qs.qu_name);
  log_err(-1, __func__, log_buf);

  unlock_allques_mutex(aq, __func__, "2", LOGLEVEL);

  return(rc);
  } /* END remove_queue() */
Esempio n. 3
0
int remove_last_thing(

    resizable_array *ra)

  {
  return(remove_thing_from_index(ra, ra->last));
  } /* END remove_last_thing() */
Esempio n. 4
0
int  remove_job(
   
  struct all_jobs *aj, 
  job             *pjob)

  {
  int rc = PBSE_NONE;
  int index;

  if (pjob == NULL)
    {
    rc = PBSE_BAD_PARAMETER;
    log_err(rc,__func__,"null input job pointer fail");
    return(rc);
    }
  if (aj == NULL)
    {
    rc = PBSE_BAD_PARAMETER;
    log_err(rc,__func__,"null input array pointer fail");
    return(rc);
    }

  if (LOGLEVEL >= 10)
    LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid);
  if (pthread_mutex_trylock(aj->alljobs_mutex))
    {
    unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
    pthread_mutex_lock(aj->alljobs_mutex);
    lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL);

    if (pjob->ji_being_recycled == TRUE)
      {
      pthread_mutex_unlock(aj->alljobs_mutex);
      unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
      return(PBSE_JOB_RECYCLED);
      }
    }

  if ((index = get_value_hash(aj->ht,pjob->ji_qs.ji_jobid)) < 0)
    rc = THING_NOT_FOUND;
  else
    {
    remove_thing_from_index(aj->ra,index);
    remove_hash(aj->ht,pjob->ji_qs.ji_jobid);
    }

  pthread_mutex_unlock(aj->alljobs_mutex);

  return(rc);
  } /* END remove_job() */
Esempio n. 5
0
void *get_remove_from_hash_map(

  hash_map *hm,
  char     *key)

  {
  void *obj = NULL;
  int   index;

  pthread_mutex_lock(hm->hm_mutex);

  if ((index = get_value_hash(hm->hm_ht, key)) >= 0)
    {
    obj = hm->hm_ra->slots[index].item;
    remove_thing_from_index(hm->hm_ra, index);
    remove_hash(hm->hm_ht, key);
    }

  pthread_mutex_unlock(hm->hm_mutex);

  return(obj);
  } /* END get_remove_from_hash_map() */
Esempio n. 6
0
int remove_from_hash_map(

  hash_map *hm,
  char     *key)

  {
  int index;
  int rc = PBSE_NONE;

  pthread_mutex_lock(hm->hm_mutex);

  if ((index = get_value_hash(hm->hm_ht, key)) < 0)
    rc = KEY_NOT_FOUND;
  else
    {
    remove_thing_from_index(hm->hm_ra, index);
    remove_hash(hm->hm_ht, key);
    }

  pthread_mutex_unlock(hm->hm_mutex);

  return(rc);
  } /* END remove_from_hash_map() */
int remove_batch_request(

  char *br_id)

  {
  int i;

  pthread_mutex_lock(brh.brh_mutex);

  i = get_value_hash(brh.brh_ht, br_id);

  if (i >= 0)
    {
    remove_thing_from_index(brh.brh_ra, i);
    remove_hash(brh.brh_ht, br_id);
    }
  pthread_mutex_unlock(brh.brh_mutex);

  if (i < 0)
    return(THING_NOT_FOUND);
  else
    return(PBSE_NONE);
  } /* END remove_batch_request() */
batch_request *get_remove_batch_request(

  char *br_id)

  {
  batch_request *preq = NULL;
  int            i;

  pthread_mutex_lock(brh.brh_mutex);
  
  i = get_value_hash(brh.brh_ht, br_id);
  
  if (i >= 0)
    {
    preq = (batch_request *)brh.brh_ra->slots[i].item;
    remove_thing_from_index(brh.brh_ra, i);
    remove_hash(brh.brh_ht, br_id);
    }
  
  pthread_mutex_unlock(brh.brh_mutex);
  
  return(preq);
  } /* END get_remove_batch_request() */