stop_ibuf_merges:
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
if (space != NULL) {
space->stop_ibuf_merges = TRUE;
if (space->n_pending_ibuf_merges == 0) {
mutex_exit(&fil_system->mutex);
count = 0;
goto try_again;
} else {
if (count > 5000) {
ut_print_timestamp(stderr);
fputs(" InnoDB: trying to delete tablespace ", stderr);
ut_print_filename(stderr, space->name);
}
mutex_exit(&fil_system->mutex);
os_thread_sleep(20000);
count++;
goto stop_ibuf_merges;
}


Windows has condition variables now. 5 years ago, prior to Vista there was no builtin conditions. Instead Windows had events , which is another abstraction to handle interthread communication.
ReplyDeleteOne can combine events and critical sections to emulate a condition variable. It is present in MySQL sources in mysys/wincond.c (in 5.5, it is called "legacy" implementation, and left here for XP compatibility). The legacy implementation seems to borrow from this paper http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
Or, one can also emulate Windows event with a condition variable and mutex(like innodb events).
where is "try_again"?
ReplyDelete