コード例 #1
0
ファイル: workqueue.c プロジェクト: JohnPJenkins/swift-t
static inline xlb_work_unit *
wu_array_try_remove_untargeted(uint32_t wu_idx, int type, int priority)
{
  xlb_work_unit* wu = ptr_array_get(&wu_array, wu_idx);
  /*
    Check not stale.  There is a corner case here where all of these
    match but it was a different work unit to the one the targeted
    entry was created for.  In that case it doesn't matter which
    was returned.

    We need to modify priority check for adjusted priority for soft
    targeted tasks.
   */
  if (wu != NULL && wu->type == type &&
      (wu->target < 0 || wu->opts.strictness != ADLB_TGT_STRICT_HARD)) {
    int modified_priority = wu->opts.priority;
    if (wu->opts.strictness != ADLB_TGT_STRICT_HARD)
    {
      modified_priority = soft_target_priority(modified_priority);
    }
    
    if (modified_priority == priority) {
      ptr_array_remove(&wu_array, wu_idx);
      return wu;
    }
  }

  return NULL;
}
コード例 #2
0
ファイル: workqueue.c プロジェクト: JohnPJenkins/swift-t
static inline xlb_work_unit *
wu_array_try_remove_targeted(uint32_t wu_idx, int type, int target, int priority)
{
  xlb_work_unit* wu = ptr_array_get(&wu_array, wu_idx);
  /*
    Check not stale.  There is a corner case here where all of these
    match but it was a different work unit to the one the targeted
    entry was created for.  In that case it doesn't matter which
    was returned.
   */
  if (wu != NULL && wu->type == type && wu->target == target &&
      wu->opts.priority == priority) {
    ptr_array_remove(&wu_array, wu_idx);
    return wu;
  }

  return NULL;
}
コード例 #3
0
ファイル: bind.c プロジェクト: nellynette/dex
void remove_binding(const char *keys)
{
	struct key_chain chain;
	int i = bindings.count;

	if (!parse_keys(&chain, keys))
		return;

	while (i > 0) {
		struct binding *b = bindings.ptrs[--i];

		if (memcmp(&b->chain, &chain, sizeof(chain)) == 0) {
			ptr_array_remove(&bindings, i);
			free(b->command);
			free(b);
			return;
		}
	}
}