示例#1
0
DupinAttachmentDB *
dupin_attachment_db_open (Dupin * d, gchar * attachment_db, GError ** error)
{
  DupinAttachmentDB *ret;

  g_return_val_if_fail (d != NULL, NULL);
  g_return_val_if_fail (attachment_db != NULL, NULL);

  g_rw_lock_reader_lock (d->rwlock);

  if (!(ret = g_hash_table_lookup (d->attachment_dbs, attachment_db)) || ret->todelete == TRUE)
    {
      if (error != NULL && *error != NULL)
        g_set_error (error, dupin_error_quark (), DUPIN_ERROR_OPEN,
		 "Attachment DB '%s' doesn't exist.", attachment_db);

      g_rw_lock_reader_unlock (d->rwlock);
      return NULL;
    }
  else
    {
      ret->ref++;

#if DEBUG
      fprintf(stderr,"dupin_attachment_db_open: (%p) name=%s \t ref++=%d\n", g_thread_self (), attachment_db, (gint) ret->ref);
#endif
    }

  g_rw_lock_reader_unlock (d->rwlock);

  return ret;
}
/* primarily a wrapper for dealing with TLS and the hostToThread map.
 * this does not affect unprocessedHosts/processedHosts/runningHost;
 * that migration should be done as normal (from/to the respective threads) */
static void _schedulerpolicyhoststeal_migrateHost(SchedulerPolicy* policy, Host* host, pthread_t newThread) {
    MAGIC_ASSERT(policy);
    HostStealPolicyData* data = policy->data;
    g_rw_lock_reader_lock(&data->lock);
    pthread_t oldThread = (pthread_t)g_hash_table_lookup(data->hostToThreadMap, host);
    if(oldThread == newThread) {
        g_rw_lock_reader_unlock(&data->lock);
        return;
    }
    HostStealThreadData* tdata = g_hash_table_lookup(data->threadToThreadDataMap, GUINT_TO_POINTER(oldThread));
    HostStealThreadData* tdataNew = g_hash_table_lookup(data->threadToThreadDataMap, GUINT_TO_POINTER(newThread));
    g_rw_lock_reader_unlock(&data->lock);
    /* check that there's actually a thread we're migrating from */
    if(tdata) {
        /* Sanity check that the host isn't being run on another thread while migrating.
         * Ostensibly, we could make this check on *all* threads, but this is simpler, faster,
         * and should catch most bugs (since it's presumably the thread we're stealing from
         * that would be running it).
         */
        utility_assert(tdata->runningHost != tdataNew->runningHost);
        /* migrate the TLS of all objects associated with this host */
        host_migrate(host, &oldThread, &newThread);
    }
    _schedulerpolicyhoststeal_addHost(policy, host, newThread);
}
示例#3
0
/*
 * view_get_moving_tick
 */
void
view_get_moving_tick ( view *v,
                       gdouble *data )
{
  vblock *vb;
  guint i;

  g_rw_lock_reader_lock ( &(v->lock) );

  vb = v->blocks_tail;

  if ( vblock_is_empty(vb) )
    {
      if ( vblock_is_list_head(vb) )
        {
          g_rw_lock_reader_unlock ( &(v->lock) );
          bzero ( data, v->nb_cols * sizeof(gdouble) );
          return;
        }

      vb = vb->prev_block;
    }

  /* todo: replace by actual moving tick */
  for ( i=0; i<v->nb_cols; ++i )
    data = v->current_line_most_recent_data;

  g_rw_lock_reader_unlock ( &(v->lock) );
}
示例#4
0
static void
test_rwlock4 (void)
{
  static GRWLock lock;

  g_rw_lock_reader_lock (&lock);
  g_rw_lock_reader_unlock (&lock);
  g_rw_lock_reader_lock (&lock);
  g_rw_lock_reader_unlock (&lock);
}
示例#5
0
static void
test_rwlock5 (void)
{
  static GRWLock lock;
  gboolean ret;

  ret = g_rw_lock_reader_trylock (&lock);
  g_assert (ret);
  ret = g_rw_lock_reader_trylock (&lock);
  g_assert (ret);

  g_rw_lock_reader_unlock (&lock);
  g_rw_lock_reader_unlock (&lock);
}
/**
 * 获取对应对应规则的动作
 * @param table db-sql-rule规则列表
 * @param dbname 规则对应的数据库名
 * @param exist
 * @return 规则对应的动作
 */
security_action get_action_from_db_sql_rule(
		db_sql_rule_table *table,
		const char *dbname,
		const char *normalized_sql,
		int *exist
		) {
	g_assert(exist);
	security_action ret = ACTION_SAFE;
	if (NULL == table || NULL == dbname|| NULL == normalized_sql) {
		return ret;
	}

	GString *db_key = g_string_new(dbname);
	sql_rule_table *sql_rule_table_v = NULL;
	g_rw_lock_reader_lock(&table->table_lock);
	sql_rule_table_v = g_hash_table_lookup(table->db_sql_rule, db_key);
	g_rw_lock_reader_unlock(&table->table_lock);

	if (sql_rule_table_v) {
		ret = get_action_from_sql_rule(
				sql_rule_table_v,
				normalized_sql,
				exist
		);
	}
	g_string_free(db_key, TRUE);

	return ret;
}
/**
 * 设置db-sql-rule列表中规则的启停开关
 * @param table db-sql-rule规则列表
 * @param dbname 需要更新规则对应的数据库
 * @param normalized_sql 规则对应的标准化的sql
 * @param is_disabled 更新后的开关参数
 * @return 设置成功赶回TRUE,失败返回FALSE,没有找到对应的规则算失败
 */
gboolean set_switch_in_db_sql_rule(
		db_sql_rule_table *table,
		const char *dbname,
		const char *normalized_sql,
		gboolean is_disabled
		) {
	if (NULL == table || NULL == dbname|| NULL == normalized_sql) {
		return FALSE;
	}
	gboolean ret = FALSE;
	GString *db_key = g_string_new(dbname);
	sql_rule_table *sql_rule_table_v = NULL;
	g_rw_lock_reader_lock(&table->table_lock);
	sql_rule_table_v = g_hash_table_lookup(table->db_sql_rule, db_key);
	g_rw_lock_reader_unlock(&table->table_lock);

	if (sql_rule_table_v) {
		ret = set_switch_in_sql_rule(
				sql_rule_table_v,
				normalized_sql,
				is_disabled
				);
	}

	g_string_free(db_key, TRUE);
	return ret;
}
/**
 * 从user-db-sql-rule的列表中查询相应的规则
 * @param table db-sql-rule规则列表
 * @param user 规则对应的用户名
 * @param dbname 规则对应的数据库名
 * @param normalized_sql 标准化sql
 * @param type 规则的类型
 * @return 规则的变量指针
 */
sql_security_rule* get_rule_from_user_db_sql_rule(
		user_db_sql_rule_table *table,
		const char *user,
		const char *dbname,
		const char *normalized_sql,
		security_model_type type) {
	g_assert(IS_CORRECT_TYPE(type));
	if (NULL == table || NULL == table->user_db_sql_rule[type]) {
		return NULL;
	}
	if (NULL == user || NULL == dbname || NULL == normalized_sql) {
		return NULL;
	}

	GString *user_key = g_string_new(user);
	sql_security_rule* rule = NULL;
	db_sql_rule_table* db_sql_rule_table_v = NULL;

	g_rw_lock_reader_lock(&table->table_lock[type]);
	db_sql_rule_table_v = g_hash_table_lookup(table->user_db_sql_rule[type], user_key);
	g_rw_lock_reader_unlock(&table->table_lock[type]);

	if (db_sql_rule_table_v) {
		rule = get_rule_from_db_sql_rule(
				db_sql_rule_table_v,
				dbname,
				normalized_sql);
	}
	g_string_free(user_key, TRUE);
	return rule;
}
/**
 * 设置user-db-sql-rule列表中规则的启停开关
 * @param table db-sql-rule规则列表
 * @param user 规则对应的用户名
 * @param dbname 规则对应的数据库名
 * @param normalized_sql 标准化sql
 * @param type 规则类型
 * @param is_disabled 更新后的开关参数
 * @return 修改成功返回TRUE,失败返回FALSE,没有对应规则视为失败
 */
gboolean set_switch_in_user_db_sql_rule(
		user_db_sql_rule_table *table,
		const char *user,
		const char *dbname,
		const char *normalized_sql,
		security_model_type type,
		gboolean is_disabled) {

	g_assert(IS_CORRECT_TYPE(type));

	if (NULL == table || NULL == table->user_db_sql_rule[type]) {
		return FALSE;
	}
	if (NULL == user || NULL == dbname || NULL == normalized_sql) {
		return FALSE;
	}

	GString *user_key = g_string_new(user);
	gboolean ret = FALSE;
	db_sql_rule_table* db_sql_rule_table_v = NULL;

	g_rw_lock_reader_lock(&table->table_lock[type]);
	db_sql_rule_table_v = g_hash_table_lookup(table->user_db_sql_rule[type], user_key);
	g_rw_lock_reader_unlock(&table->table_lock[type]);

	if (db_sql_rule_table_v) {
		ret = set_switch_in_db_sql_rule(
				db_sql_rule_table_v,
				dbname,
				normalized_sql,
				is_disabled);
	}
	g_string_free(user_key, TRUE);
	return ret;
}
示例#10
0
void
view_write_json ( view *v,
                  gboolean sendFull,
                  const gdouble user_offset,
                  FILE *f )
{
  gdouble offset;

#ifdef DEBUG_VIEW_JSON
  fprintf ( stderr, "user offset=%f\n", user_offset );
#endif

  g_rw_lock_reader_lock ( &(v->lock) );

  if ( user_offset == -1 )
    offset = v->most_recent_entry - v->length;
  else if ( user_offset > v->most_recent_entry )
    offset = v->most_recent_entry - 60;
  else
    offset = user_offset;

#ifdef DEBUG_VIEW_JSON
  fprintf ( stderr, "final offset=%f\n", offset );
#endif

  write_json ( v, sendFull, offset, f );

  g_rw_lock_reader_unlock ( &(v->lock) );
}
示例#11
0
//returns sock. Must unlock after usage. Otherwise the sock cannot be reused
static void* notify_random_publisher(struct inotify_event *pevent, publishers_info *pub_interface)
{
	char * instance_num = malloc(10);
	sprintf(instance_num, "%d",  (rand()%REPLICATION_FACTOR) + 1);

	char * publishable = to_c_string(pevent->name, pevent->len, (pevent->len + strlen(instance_num) + 1));
	strcat(publishable, instance_num);

	g_rw_lock_reader_lock (&lock);

	hash_ring_node_t *node = hash_ring_find_node(pub_interface->publisher_ring, (uint8_t*)publishable, strlen(publishable));
	char *publisher = to_c_string((char*)node->name, node->nameLen, node->nameLen + 1);
	void* ret =  g_hash_table_lookup(pub_interface->publisher_socks, publisher);
	void* mutex =  g_hash_table_lookup(pub_interface->publisher_socks_locks, publisher);

	g_rw_lock_reader_unlock (&lock);	
	free(publisher);
	free(publishable);
	free(instance_num);

	g_mutex_lock (mutex);
	notify(ret, pevent);
	g_mutex_unlock (mutex);
	
	return ret;

}
示例#12
0
文件: fu-mutex.c 项目: vathpela/fwupd
/**
 * fu_mutex_unlock:
 * @self: a #FuMutex
 *
 * Release a read or write lock.
 *
 * Since: 1.1.2
 **/
void
fu_mutex_unlock (FuMutex *self, FuMutexAccess kind)
{
	if (kind == FU_MUTEX_ACCESS_READ)
		g_rw_lock_reader_unlock (&self->rw_lock);
	else if (kind == FU_MUTEX_ACCESS_WRITE)
		g_rw_lock_writer_unlock (&self->rw_lock);
}
示例#13
0
static void
verify_even (gpointer data)
{
  g_rw_lock_reader_lock (&even_lock);

  g_assert (even % 2 == 0);

  g_rw_lock_reader_unlock (&even_lock);
}
示例#14
0
/*
 * refstore_get_most_recent_data
 */
void
refstore_get_most_recent_data ( refstore *rs,
                                gdouble *data )
{
  g_rw_lock_reader_lock ( &(rs->lock) );
  memcpy ( data, rs->most_recent_data, sizeof(gdouble)*STORE_BLOCK_COLS );
  g_rw_lock_reader_unlock ( &(rs->lock) );
  return;
}
示例#15
0
static uint16_t
get_raw_data(unsigned char code)
{
    uint16_t w;
    g_rw_lock_reader_lock(&co2mon_data_lock);
    w = co2mon_data[code];
    g_rw_lock_reader_unlock(&co2mon_data_lock);
    return w;
}
示例#16
0
gchar *
proxy_get_csurl (void)
{
	g_rw_lock_reader_lock (&csurl_rwlock);
	const guint i = oio_ext_rand_int_range(0, csurl_count);
	gchar *cs = g_strdup(csurl[i]);
	g_rw_lock_reader_unlock (&csurl_rwlock);
	return cs;
}
static void clear_queue(guint stream_id, GstScreamQueue *self)
{
    GstScreamStream *stream;
    g_rw_lock_reader_lock(&self->lock);
    stream = g_hash_table_lookup(self->streams, GUINT_TO_POINTER(stream_id));
    g_rw_lock_reader_unlock(&self->lock);
    clear_packet_queue(stream->packet_queue);
    stream->enqueued_payload_size = 0;
    stream->enqueued_packets = 0;
    gst_pad_push_event(self->sink_pad,
        gst_video_event_new_upstream_force_key_unit(GST_CLOCK_TIME_NONE, FALSE, 0));
}
示例#18
0
gboolean
dupin_attachment_db_exists (Dupin * d, gchar * attachment_db_name)
{
  gboolean ret;

  g_rw_lock_reader_lock (d->rwlock);
  DupinAttachmentDB * attachment_db = g_hash_table_lookup (d->attachment_dbs, attachment_db_name);
  ret = ((attachment_db != NULL) && attachment_db->todelete == FALSE) ? TRUE : FALSE;
  g_rw_lock_reader_unlock (d->rwlock);

  return ret;
}
示例#19
0
/**
 * 下面实现了一些简单的连接池统计的操作函数,主要是在连接池建立时作为需要建立连接数的修改,以及连接释放时更新的对象
 *
 */
pool_status * get_conn_pool_status(network_connection_pool *pool,
		const gchar *username) {
	pool_status *ps = NULL;
	g_assert(pool);
	g_assert(username);
	g_rw_lock_reader_lock(&pool->pool_status_lock);
	if (pool->conn_pool_status) {
		ps = g_hash_table_lookup(pool->conn_pool_status, username);
	}
	g_rw_lock_reader_unlock(&pool->pool_status_lock);
	return ps;
}
static void on_bitrate_change(guint bitrate, guint stream_id, GstScreamQueue *self)
{
    GstScreamStream *stream;

    GST_DEBUG_OBJECT(self, "Updating bitrate of stream %u to %u bps", stream_id, bitrate);

    g_rw_lock_reader_lock(&self->lock);
    stream = g_hash_table_lookup(self->streams, GUINT_TO_POINTER(stream_id));
    g_rw_lock_reader_unlock(&self->lock);

    g_signal_emit_by_name(self, "on-bitrate-change", bitrate, stream->ssrc, stream->pt);
}
示例#21
0
文件: sql.c 项目: rowhit/Tagsistant
/**
 * Release a DBI connection
 *
 * @param dbi the connection to be released
 */
void tagsistant_db_connection_release(dbi_conn dbi, gboolean is_writer_locked)
{
	/* release the connection back to the pool */
	g_mutex_lock(&tagsistant_connection_pool_lock);
	tagsistant_connection_pool = g_list_prepend(tagsistant_connection_pool, dbi);
	g_mutex_unlock(&tagsistant_connection_pool_lock);

	if (is_writer_locked) {
		g_rw_lock_writer_unlock(&tagsistant_query_rwlock);
	} else {
		g_rw_lock_reader_unlock(&tagsistant_query_rwlock);
	}
}
示例#22
0
/**
 * gst_meta_get_info:
 * @impl: the name
 *
 * Lookup a previously registered meta info structure by its implementation name
 * @impl.
 *
 * Returns: (transfer none): a #GstMetaInfo with @impl, or #NULL when no such
 * metainfo exists.
 */
const GstMetaInfo *
gst_meta_get_info (const gchar * impl)
{
  GstMetaInfo *info;

  g_return_val_if_fail (impl != NULL, NULL);

  g_rw_lock_reader_lock (&lock);
  info = g_hash_table_lookup (metainfo, impl);
  g_rw_lock_reader_unlock (&lock);

  return info;
}
示例#23
0
GError*
meta0_backend_destroy_meta1_ref(struct meta0_backend_s *m0, gchar *meta1)
{
	GError *err = NULL;
	struct sqlx_sqlite3_s *sq3 = NULL;
	struct sqlx_repctx_s *repctx = NULL;
	GPtrArray *result;
	gchar *v, *addr, *ref, *nb;
	guint i, max, cmpaddr, cmpstate;

	EXTRA_ASSERT(m0 != NULL);
	EXTRA_ASSERT(meta1 != NULL);

	/* check if meta1 is disable */
	if (NULL != (err = _reload(m0, TRUE))) {
		g_prefix_error(&err, "Reload error: ");
		return err;
	}

	g_rw_lock_reader_lock(&(m0->rwlock));
	EXTRA_ASSERT(m0->array_meta1_ref != NULL);
	result = meta0_utils_array_meta1ref_dup(m0->array_meta1_ref);
	g_rw_lock_reader_unlock(&(m0->rwlock));

	for (i=0,max=result->len; i<max ;i++) {
		if (!(v = result->pdata[i]))
			continue;
		meta0_utils_unpack_meta1ref(v,&addr,&ref,&nb);
		cmpaddr = g_ascii_strcasecmp(addr,meta1);
		cmpstate = g_ascii_strcasecmp(ref,"0");
		g_free(addr);
		g_free(ref);
		g_free(nb);
		if ( cmpaddr == 0) {
			if (cmpstate != 0)
				return NEWERROR(EINVAL, "meta1 always available to prefix allocation");
			err = _open_and_lock(m0, M0V2_OPENBASE_MASTERONLY, &sq3);
			if (NULL != err)
				return err;

			err = sqlx_transaction_begin(sq3, &repctx);
			if (NULL == err) {
				err = _delete_meta1_ref(sq3->db, meta1);
				err = sqlx_transaction_end(repctx, err);
			}
			_unlock_and_close(sq3);
			return err;
		}
	}
	return NEWERROR(EINVAL, "UNKNOWN meta1");
}
static void _schedulerpolicyhoststeal_findMinTime(Host* host, HostStealSearchState* state) {
    g_rw_lock_reader_lock(&state->data->lock);
    HostStealQueueData* qdata = g_hash_table_lookup(state->data->hostToQueueDataMap, host);
    g_rw_lock_reader_unlock(&state->data->lock);
    utility_assert(qdata);

    g_mutex_lock(&(qdata->lock));
    Event* event = priorityqueue_peek(qdata->pq);
    g_mutex_unlock(&(qdata->lock));

    if(event != NULL) {
        state->nextEventTime = MIN(state->nextEventTime, event_getTime(event));
    }
}
static guint get_next_packet_rtp_payload_size(guint stream_id, GstScreamQueue *self)
{
    GstScreamDataQueueRtpItem *item;
    GstScreamStream *stream;
    guint size = 0;

    g_rw_lock_reader_lock(&self->lock);
    stream = g_hash_table_lookup(self->streams, GUINT_TO_POINTER(stream_id));
    g_rw_lock_reader_unlock(&self->lock);
    if ((item = gst_atomic_queue_peek(stream->packet_queue))) {
        size = item->rtp_payload_size;
    }
    return size;
}
示例#26
0
文件: drew.c 项目: bk2204/drew
int drew_loader_get_type(DrewLoader *ldr, int id)
{
    if (!ldr)
        return -DREW_ERR_INVALID;

    g_rw_lock_reader_lock(&ldr->lock);

    int retval = is_valid_id(ldr, id, 0) ? ldr->plugin[id].type :
                 -DREW_ERR_INVALID;

    g_rw_lock_reader_unlock(&ldr->lock);

    return retval;
}
static Event* _schedulerpolicyhoststeal_popFromThread(SchedulerPolicy* policy, HostStealThreadData* tdata, GQueue* assignedHosts, SimulationTime barrier) {
    /* if there is no tdata, that means this thread didn't get any hosts assigned to it */
    if(!tdata) {
        return NULL;
    }

    HostStealPolicyData* data = policy->data;

    while(!g_queue_is_empty(assignedHosts) || tdata->runningHost) {
        /* if there's no running host, we completed the last assignment and need a new one */
        if(!tdata->runningHost) {
            tdata->runningHost = g_queue_pop_head(assignedHosts);
        }
        Host* host = tdata->runningHost;
        g_rw_lock_reader_lock(&data->lock);
        HostStealQueueData* qdata = g_hash_table_lookup(data->hostToQueueDataMap, host);
        g_rw_lock_reader_unlock(&data->lock);
        utility_assert(qdata);

        g_mutex_lock(&(qdata->lock));
        Event* nextEvent = priorityqueue_peek(qdata->pq);
        SimulationTime eventTime = (nextEvent != NULL) ? event_getTime(nextEvent) : SIMTIME_INVALID;

        if(nextEvent != NULL && eventTime < barrier) {
            utility_assert(eventTime >= qdata->lastEventTime);
            qdata->lastEventTime = eventTime;
            nextEvent = priorityqueue_pop(qdata->pq);
            qdata->nPopped++;
            /* migrate iff a migration is needed */
            _schedulerpolicyhoststeal_migrateHost(policy, host, pthread_self());
        } else {
            nextEvent = NULL;
        }

        if(nextEvent == NULL) {
            /* no more events on the runningHost, mark it as NULL so we get a new one */
            g_queue_push_tail(tdata->processedHosts, host);
            tdata->runningHost = NULL;
        }

        g_mutex_unlock(&(qdata->lock));

        if(nextEvent != NULL) {
            return nextEvent;
        }
    }

    /* if we make it here, all hosts for this thread have no more events before barrier */
    return NULL;
}
示例#28
0
static void
dupin_attachment_db_p_update_real (DupinAttachmentDBP * p,
				   DupinAttachmentDB *  attachment_db)
{
  g_rw_lock_reader_lock (attachment_db->rwlock);
  gboolean todelete = attachment_db->todelete;
  g_rw_lock_reader_unlock (attachment_db->rwlock);

  if (todelete == TRUE)
    {
      if (p->attachment_dbs != NULL)
        {
          /* NOTE - need to remove pointer from parent if linkb is "hot deleted" */

          DupinAttachmentDB ** attachment_dbs = g_malloc (sizeof (DupinAttachmentDB *) * p->size);

          gint i;
          gint current_numb = p->numb;
          p->numb = 0;
          for (i=0; i < current_numb ; i++)
            {
              if (p->attachment_dbs[i] != attachment_db)
                {
                  attachment_dbs[p->numb] = p->attachment_dbs[i];
                  p->numb++;
                }
            }
          g_free (p->attachment_dbs);
          p->attachment_dbs = attachment_dbs;
        }

      return;
    }

  if (p->attachment_dbs == NULL)
    {
      p->attachment_dbs = g_malloc (sizeof (DupinAttachmentDB *) * DUPIN_ATTACHMENT_DB_P_SIZE);
      p->size = DUPIN_ATTACHMENT_DB_P_SIZE;
    }

  else if (p->numb == p->size)
    {
      p->size += DUPIN_ATTACHMENT_DB_P_SIZE;
      p->attachment_dbs = g_realloc (p->attachment_dbs, sizeof (DupinAttachmentDB *) * p->size);
    }

  p->attachment_dbs[p->numb] = attachment_db;
  p->numb++;
}
示例#29
0
文件: drew.c 项目: bk2204/drew
int drew_loader_lookup_by_type(DrewLoader *ldr, int type, int start,
                               int end)
{
    if (!ldr)
        return -DREW_ERR_INVALID;

    g_rw_lock_reader_lock(&ldr->lock);

    if (end == -1)
        end = ldr->nplugins;

    for (int i = start; i < end; i++) {
        if (!is_valid_id(ldr, i, 0))
            continue;
        if (ldr->plugin[i].type == type) {
            g_rw_lock_reader_unlock(&ldr->lock);
            return i;
        }
    }

    g_rw_lock_reader_unlock(&ldr->lock);

    return -DREW_ERR_NONEXISTENT;
}
static void _schedulerpolicyhoststeal_push(SchedulerPolicy* policy, Event* event, Host* srcHost, Host* dstHost, SimulationTime barrier) {
    MAGIC_ASSERT(policy);
    HostStealPolicyData* data = policy->data;

    /* non-local events must be properly delayed so the event wont show up at another host
     * before the next scheduling interval. if the thread scheduler guaranteed to always run
     * the minimum time event accross all of its assigned hosts, then we would only need to
     * do the time adjustment if the srcThread and dstThread are not identical. however,
     * the logic of this policy allows a thread to run all events from a given host before
     * moving on to the next host, so we must adjust the time whenever the srcHost and
     * dstHost are not the same. */
    SimulationTime eventTime = event_getTime(event);

    if(srcHost != dstHost && eventTime < barrier) {
        event_setTime(event, barrier);
        info("Inter-host event time %"G_GUINT64_FORMAT" changed to %"G_GUINT64_FORMAT" "
                "to ensure event causality", eventTime, barrier);
    }

    g_rw_lock_reader_lock(&data->lock);
    /* we want to track how long this thread spends idle waiting to push the event */
    HostStealThreadData* tdata = g_hash_table_lookup(data->threadToThreadDataMap, GUINT_TO_POINTER(pthread_self()));

    /* get the queue for the destination */
    HostStealQueueData* qdata = g_hash_table_lookup(data->hostToQueueDataMap, dstHost);
    g_rw_lock_reader_unlock(&data->lock);
    utility_assert(qdata);

    /* tracking idle time spent waiting for the destination queue lock */
    if(tdata) {
        g_timer_continue(tdata->pushIdleTime);
        g_mutex_lock(&(tdata->lock));
    }
    g_mutex_lock(&(qdata->lock));
    if(tdata) {
        g_timer_stop(tdata->pushIdleTime);
    }

    /* 'deliver' the event to the destination queue */
    priorityqueue_push(qdata->pq, event);
    qdata->nPushed++;

    /* release the destination queue lock */
    g_mutex_unlock(&(qdata->lock));
    if(tdata) {
        g_mutex_unlock(&(tdata->lock));
    }
}