本文整理汇总了C++中UT_LIST_GET_FIRST函数的典型用法代码示例。如果您正苦于以下问题:C++ UT_LIST_GET_FIRST函数的具体用法?C++ UT_LIST_GET_FIRST怎么用?C++ UT_LIST_GET_FIRST使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UT_LIST_GET_FIRST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trx_sig_reply_wait_to_suspended
/***********************************************************//**
Moves the query threads in the sig reply wait list of trx to the SUSPENDED
state. */
static
void
trx_sig_reply_wait_to_suspended(
/*============================*/
trx_t* trx) /*!< in: transaction */
{
trx_sig_t* sig;
que_thr_t* thr;
ut_ad(mutex_own(&kernel_mutex));
sig = UT_LIST_GET_FIRST(trx->reply_signals);
while (sig != NULL) {
thr = sig->receiver;
ut_ad(thr->state == QUE_THR_SIG_REPLY_WAIT);
thr->state = QUE_THR_SUSPENDED;
sig->receiver = NULL;
UT_LIST_REMOVE(reply_signals, trx->reply_signals, sig);
sig = UT_LIST_GET_FIRST(trx->reply_signals);
}
}
示例2: buf_LRU_old_init
/***********************************************************************
Initializes the old blocks pointer in the LRU list. This function should be
called when the LRU list grows to BUF_LRU_OLD_MIN_LEN length. */
static
void
buf_LRU_old_init(void)
/*==================*/
{
buf_block_t* block;
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use
the adjust function to move the LRU_old pointer to the right
position */
block = UT_LIST_GET_FIRST(buf_pool->LRU);
while (block != NULL) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->in_LRU_list);
block->old = TRUE;
block = UT_LIST_GET_NEXT(LRU, block);
}
buf_pool->LRU_old = UT_LIST_GET_FIRST(buf_pool->LRU);
buf_pool->LRU_old_len = UT_LIST_GET_LEN(buf_pool->LRU);
buf_LRU_old_adjust_len();
}
示例3: TRACE
void OSEventThread::firePending()
{
TRACE("~~~~ +firePending ~~~~\n");
event_req_t * ev;
while (ev = UT_LIST_GET_FIRST(mPendingList)) {
UT_LIST_REMOVE(activeNode,mPendingList,ev);
try
{
ev->func(ev->fd, OSEventContext::EV_RE, ev->param);
ev->status = 0;
}
catch (...) {
ERR("Falut req = %p\n",ev);
ASSERT_C(0);
}
}
event_timer_t * tev;
while (tev = UT_LIST_GET_FIRST(mTimeoutList)) {
UT_LIST_REMOVE(activeNode,mTimeoutList,tev);
try
{
tev->func(tev->timeout, tev->param);
tev->status = 0;
}
catch (...) {
ERR("Falut timer = %p\n",tev);
ASSERT_C(0);
}
}
TRACE("~~~~ -firePending ~~~~\n");
}
示例4: sym_tab_free_private
/******************************************************************//**
Frees the memory allocated dynamically AFTER parsing phase for variables
etc. in the symbol table. Does not free the mem heap where the table was
originally created. Frees also SQL explicit cursor definitions. */
UNIV_INTERN
void
sym_tab_free_private(
/*=================*/
sym_tab_t* sym_tab) /*!< in, own: symbol table */
{
sym_node_t* sym;
func_node_t* func;
sym = UT_LIST_GET_FIRST(sym_tab->sym_list);
while (sym) {
eval_node_free_val_buf(sym);
if (sym->prefetch_buf) {
sel_col_prefetch_buf_free(sym->prefetch_buf);
}
if (sym->cursor_def) {
que_graph_free_recursive(sym->cursor_def);
}
sym = UT_LIST_GET_NEXT(sym_list, sym);
}
func = UT_LIST_GET_FIRST(sym_tab->func_node_list);
while (func) {
eval_node_free_val_buf(func);
func = UT_LIST_GET_NEXT(func_node_list, func);
}
}
示例5: os_sync_free
/*********************************************************//**
Frees created events and OS 'slow' mutexes. */
UNIV_INTERN
void
os_sync_free(void)
/*==============*/
{
os_event_t event;
os_mutex_t mutex;
os_sync_free_called = TRUE;
event = UT_LIST_GET_FIRST(os_event_list);
while (event) {
os_event_free(event);
event = UT_LIST_GET_FIRST(os_event_list);
}
mutex = UT_LIST_GET_FIRST(os_mutex_list);
while (mutex) {
if (mutex == os_sync_mutex) {
/* Set the flag to FALSE so that we do not try to
reserve os_sync_mutex any more in remaining freeing
operations in shutdown */
os_sync_mutex_inited = FALSE;
}
os_mutex_free(mutex);
mutex = UT_LIST_GET_FIRST(os_mutex_list);
}
os_sync_free_called = FALSE;
}
示例6: rw_lock_list_print_info
/***************************************************************//**
Prints debug info of currently locked rw-locks. */
UNIV_INTERN
void
rw_lock_list_print_info(
/*====================*/
FILE* file) /*!< in: file where to print */
{
rw_lock_t* lock;
ulint count = 0;
rw_lock_debug_t* info;
mutex_enter(&rw_lock_list_mutex);
fputs("-------------\n"
"RW-LATCH INFO\n"
"-------------\n", file);
lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) {
count++;
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_enter(&(lock->mutex));
#endif
if (lock->lock_word != X_LOCK_DECR) {
fprintf(file, "RW-LOCK: %p ", (void*) lock);
if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", file);
} else {
putc('\n', file);
}
rw_lock_debug_mutex_enter();
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
rw_lock_debug_print(file, info);
info = UT_LIST_GET_NEXT(list, info);
}
rw_lock_debug_mutex_exit();
}
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_exit(&(lock->mutex));
#endif
lock = UT_LIST_GET_NEXT(list, lock);
}
fprintf(file, "Total number of rw-locks %ld\n", count);
mutex_exit(&rw_lock_list_mutex);
}
示例7: rw_lock_list_print_info
void
rw_lock_list_print_info(void)
/*=========================*/
{
#ifndef UNIV_SYNC_DEBUG
#else
rw_lock_t* lock;
ulint count = 0;
rw_lock_debug_t* info;
mutex_enter(&rw_lock_list_mutex);
printf("-------------\n");
printf("RW-LATCH INFO\n");
printf("-------------\n");
lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) {
count++;
mutex_enter(&(lock->mutex));
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
printf("RW-LOCK: %lx ", (ulint)lock);
if (rw_lock_get_waiters(lock)) {
printf(" Waiters for the lock exist\n");
} else {
printf("\n");
}
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
rw_lock_debug_print(info);
info = UT_LIST_GET_NEXT(list, info);
}
}
mutex_exit(&(lock->mutex));
lock = UT_LIST_GET_NEXT(list, lock);
}
printf("Total number of rw-locks %ld\n", count);
mutex_exit(&rw_lock_list_mutex);
#endif
}
示例8: rw_lock_list_print_info
void
rw_lock_list_print_info(
/*====================*/
FILE* file) /* in: file where to print */
{
rw_lock_t* lock;
ulint count = 0;
rw_lock_debug_t* info;
mutex_enter(&rw_lock_list_mutex);
fputs("-------------\n"
"RW-LATCH INFO\n"
"-------------\n", file);
lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) {
count++;
mutex_enter(&(lock->mutex));
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
fprintf(file, "RW-LOCK: %p ", (void*) lock);
if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", file);
} else {
putc('\n', file);
}
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
rw_lock_debug_print(info);
info = UT_LIST_GET_NEXT(list, info);
}
}
mutex_exit(&(lock->mutex));
lock = UT_LIST_GET_NEXT(list, lock);
}
fprintf(file, "Total number of rw-locks %ld\n", count);
mutex_exit(&rw_lock_list_mutex);
}
示例9: trx_assign_rseg
/******************************************************************//**
Assigns a rollback segment to a transaction in a round-robin fashion.
Skips the SYSTEM rollback segment if another is available.
@return assigned rollback segment id */
UNIV_INLINE
ulint
trx_assign_rseg(void)
/*=================*/
{
trx_rseg_t* rseg = trx_sys->latest_rseg;
ut_ad(mutex_own(&kernel_mutex));
loop:
/* Get next rseg in a round-robin fashion */
rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
if (rseg == NULL) {
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
}
/* If it is the SYSTEM rollback segment, and there exist others, skip
it */
if ((rseg->id == TRX_SYS_SYSTEM_RSEG_ID)
&& (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) {
goto loop;
}
trx_sys->latest_rseg = rseg;
return(rseg->id);
}
示例10: buf_flush_validate_low
/**********************************************************************
Validates the flush list. */
static
ibool
buf_flush_validate_low(void)
/*========================*/
/* out: TRUE if ok */
{
buf_block_t* block;
dulint om;
UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list);
block = UT_LIST_GET_FIRST(buf_pool->flush_list);
while (block != NULL) {
om = block->oldest_modification;
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(ut_dulint_cmp(om, ut_dulint_zero) > 0);
block = UT_LIST_GET_NEXT(flush_list, block);
if (block) {
ut_a(ut_dulint_cmp(om, block->oldest_modification)
>= 0);
}
}
return(TRUE);
}
示例11: rw_lock_n_locked
ulint
rw_lock_n_locked(void)
/*==================*/
{
#ifndef UNIV_SYNC_DEBUG
printf(
"Sorry, cannot give rw-lock info in non-debug version!\n");
ut_error;
return(0);
#else
rw_lock_t* lock;
ulint count = 0;
mutex_enter(&rw_lock_list_mutex);
lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) {
mutex_enter(rw_lock_get_mutex(lock));
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)) {
count++;
}
mutex_exit(rw_lock_get_mutex(lock));
lock = UT_LIST_GET_NEXT(list, lock);
}
mutex_exit(&rw_lock_list_mutex);
return(count);
#endif
}
示例12: rw_lock_print
void
rw_lock_print(
/*==========*/
rw_lock_t* lock) /* in: rw-lock */
{
#ifndef UNIV_SYNC_DEBUG
printf(
"Sorry, cannot give rw-lock info in non-debug version!\n");
#else
ulint count = 0;
rw_lock_debug_t* info;
printf("-------------\n");
printf("RW-LATCH INFO\n");
printf("RW-LATCH: %lx ", (ulint)lock);
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
if (rw_lock_get_waiters(lock)) {
printf(" Waiters for the lock exist\n");
} else {
printf("\n");
}
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
rw_lock_debug_print(info);
info = UT_LIST_GET_NEXT(list, info);
}
}
#endif
}
示例13: trx_list_insert_ordered
/****************************************************************//**
Inserts the trx handle in the trx system trx list in the right position.
The list is sorted on the trx id so that the biggest id is at the list
start. This function is used at the database startup to insert incomplete
transactions to the list. */
static
void
trx_list_insert_ordered(
/*====================*/
trx_t* trx) /*!< in: trx handle */
{
trx_t* trx2;
ut_ad(mutex_own(&kernel_mutex));
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
while (trx2 != NULL) {
if (ut_dulint_cmp(trx->id, trx2->id) >= 0) {
ut_ad(ut_dulint_cmp(trx->id, trx2->id) == 1);
break;
}
trx2 = UT_LIST_GET_NEXT(trx_list, trx2);
}
if (trx2 != NULL) {
trx2 = UT_LIST_GET_PREV(trx_list, trx2);
if (trx2 == NULL) {
UT_LIST_ADD_FIRST(trx_list, trx_sys->trx_list, trx);
} else {
UT_LIST_INSERT_AFTER(trx_list, trx_sys->trx_list,
trx2, trx);
}
} else {
UT_LIST_ADD_LAST(trx_list, trx_sys->trx_list, trx);
}
}
示例14: rw_lock_n_locked
/***************************************************************//**
Returns the number of currently locked rw-locks. Works only in the debug
version.
@return number of locked rw-locks */
UNIV_INTERN
ulint
rw_lock_n_locked(void)
/*==================*/
{
rw_lock_t* lock;
ulint count = 0;
mutex_enter(&rw_lock_list_mutex);
lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) {
if (lock->lock_word != X_LOCK_DECR) {
count++;
}
lock = UT_LIST_GET_NEXT(list, lock);
}
mutex_exit(&rw_lock_list_mutex);
return(count);
}
示例15: buf_LRU_get_recent_limit
ulint
buf_LRU_get_recent_limit(void)
/*==========================*/
/* out: the limit; zero if could not determine it */
{
buf_block_t* block;
ulint len;
ulint limit;
mutex_enter(&(buf_pool->mutex));
len = UT_LIST_GET_LEN(buf_pool->LRU);
if (len < BUF_LRU_OLD_MIN_LEN) {
/* The LRU list is too short to do read-ahead */
mutex_exit(&(buf_pool->mutex));
return(0);
}
block = UT_LIST_GET_FIRST(buf_pool->LRU);
limit = block->LRU_position - len / BUF_LRU_INITIAL_RATIO;
mutex_exit(&(buf_pool->mutex));
return(limit);
}