#include "univ.i"
#include <pthread.h>
Go to the source code of this file.
Typedefs | |
typedef pthread_t | os_thread_t |
typedef os_thread_t | os_thread_id_t |
typedef void *(* | os_posix_f_t )(void *) |
Functions | |
UNIV_INTERN ibool | os_thread_eq (os_thread_id_t a, os_thread_id_t b) |
UNIV_INTERN ulint | os_thread_pf (os_thread_id_t a) |
UNIV_INTERN os_thread_t | os_thread_create (os_posix_f_t start_f, void *arg, os_thread_id_t *thread_id) |
UNIV_INTERN void | os_thread_exit (void *exit_value) |
UNIV_INTERN os_thread_id_t | os_thread_get_curr_id (void) |
UNIV_INTERN os_thread_t | os_thread_get_curr (void) |
UNIV_INTERN void | os_thread_yield (void) |
UNIV_INTERN void | os_thread_sleep (ulint tm) |
UNIV_INTERN ulint | os_thread_get_priority (os_thread_t handle) |
UNIV_INTERN void | os_thread_set_priority (os_thread_t handle, ulint pri) |
UNIV_INTERN ulint | os_thread_get_last_error (void) |
The interface to the operating system process and thread control primitives
Created 9/8/1995 Heikki Tuuri
Definition in file os0thread.h.
typedef os_thread_t os_thread_id_t |
In Unix we use the thread handle itself as the id of the thread
Definition at line 53 of file os0thread.h.
UNIV_INTERN os_thread_t os_thread_create | ( | os_posix_f_t | start_f, |
void * | arg, | ||
os_thread_id_t * | thread_id | ||
) |
Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter and returns a ulint. NOTE: We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit.
Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter and returns an ulint.
arg | in: argument to start function |
thread_id | out: id of the created thread, or NULL |
Definition at line 110 of file os0thread.cc.
References os_mutex_enter(), os_mutex_exit(), os_sync_mutex, and os_thread_count.
Referenced by innobase_start_or_create_for_mysql(), and recv_recovery_rollback_active().
UNIV_INTERN ibool os_thread_eq | ( | os_thread_id_t | a, |
os_thread_id_t | b | ||
) |
Compares two thread ids for equality.
Compares two thread ids for equality.
a | in: OS thread or thread id |
b | in: OS thread or thread id |
Definition at line 46 of file os0thread.cc.
Referenced by srv_error_monitor_thread().
UNIV_INTERN void os_thread_exit | ( | void * | exit_value | ) |
Exits the current thread. in: exit value; in Windows this void* is cast as a DWORD
Exits the current thread.
exit_value | in: exit value; in Windows this void* is cast as a DWORD |
Definition at line 199 of file os0thread.cc.
References os_mutex_enter(), os_mutex_exit(), os_sync_mutex, os_thread_count, os_thread_get_curr_id(), and os_thread_pf().
Referenced by os_event_wait_low(), os_event_wait_time_low(), srv_error_monitor_thread(), srv_lock_timeout_thread(), srv_LRU_dump_restore_thread(), srv_master_thread(), srv_monitor_thread(), srv_purge_thread(), and trx_rollback_or_clean_all_recovered().
UNIV_INTERN os_thread_t os_thread_get_curr | ( | void | ) |
Returns handle to the current thread.
Definition at line 230 of file os0thread.cc.
UNIV_INTERN os_thread_id_t os_thread_get_curr_id | ( | void | ) |
Returns the thread identifier of current thread.
Returns the thread identifier of current thread. Currently the thread identifier in Unix is the thread handle itself. Note that in HP-UX pthread_t is a struct of 3 fields.
Definition at line 93 of file os0thread.cc.
Referenced by mutex_enter_nowait_func(), os_thread_exit(), row_create_index_for_mysql(), row_create_table_for_mysql(), row_discard_tablespace_for_mysql(), row_drop_database_for_mysql(), row_import_tablespace_for_mysql(), row_insert_for_mysql(), row_lock_table_autoinc_for_mysql(), row_lock_table_for_mysql(), row_merge_lock_table(), row_merge_rename_tables(), row_rename_table_for_mysql(), row_search_for_mysql(), row_truncate_table_for_mysql(), row_unlock_for_mysql(), row_update_for_mysql(), rw_lock_x_lock_func(), srv_error_monitor_thread(), srv_LRU_dump_restore_thread(), srv_master_thread(), srv_monitor_thread(), srv_purge_thread(), sync_array_reserve_cell(), sync_array_wait_event(), trx_allocate_for_mysql(), ut_dbg_assertion_failed(), and ut_dbg_stop_thread().
UNIV_INTERN ulint os_thread_get_last_error | ( | void | ) |
Gets the last operating system error code for the calling thread.
Definition at line 348 of file os0thread.cc.
UNIV_INTERN ulint os_thread_get_priority | ( | os_thread_t | ) |
Gets a thread priority.
Gets a thread priority.
Definition at line 316 of file os0thread.cc.
References ut_error.
UNIV_INTERN ulint os_thread_pf | ( | os_thread_id_t | a | ) |
Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is unique for the thread though!
Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is unique for the thread though!
a | in: OS thread identifier |
Definition at line 72 of file os0thread.cc.
Referenced by os_thread_exit(), rw_lock_x_lock_func(), srv_error_monitor_thread(), srv_LRU_dump_restore_thread(), srv_master_thread(), srv_monitor_thread(), srv_purge_thread(), trx_print(), ut_dbg_assertion_failed(), and ut_dbg_stop_thread().
UNIV_INTERN void os_thread_set_priority | ( | os_thread_t | handle, |
ulint | pri | ||
) |
Sets a thread priority. in: priority: one of OS_PRIORITY_...
Sets a thread priority.
handle | in: OS handle to the thread |
pri | in: priority |
Definition at line 286 of file os0thread.cc.
References ut_a, ut_error, and UT_NOT_USED.
UNIV_INTERN void os_thread_sleep | ( | ulint | tm | ) |
The thread sleeps at least the time given in microseconds. in: time in microseconds
The thread sleeps at least the time given in microseconds.
tm | in: time in microseconds |
Definition at line 265 of file os0thread.cc.
Referenced by buf_page_get_gen(), buf_page_get_zip(), buf_read_ibuf_merge_pages(), buf_read_recv_pages(), dict_index_remove_from_cache(), fil_delete_tablespace(), fil_flush(), fil_rename_tablespace(), innobase_shutdown_for_mysql(), innobase_start_or_create_for_mysql(), logs_empty_and_mark_files_at_shutdown(), os_file_create_func(), os_file_delete(), os_file_delete_if_exists(), os_file_write_func(), os_thread_yield(), recv_apply_hashed_log_recs(), recv_recovery_rollback_active(), row_drop_database_for_mysql(), srv_conc_enter_innodb(), srv_LRU_dump_restore_thread(), srv_master_thread(), srv_purge_thread(), sync_array_print_long_waits(), trx_general_rollback_for_mysql(), ut_dbg_stop_thread(), ut_malloc_low(), and ut_usectime().
UNIV_INTERN void os_thread_yield | ( | void | ) |
Advises the os to give up remainder of the thread's time slice.
Definition at line 244 of file os0thread.cc.
References os_thread_sleep().
Referenced by rw_lock_x_lock_func().