WL#5363: Thread Pool Service Interface

Affects: Server-5.5   —   Status: Complete   —   Priority: Medium

In order to allow the server to be extended with new thread pool management
modules, it is necessary to have a service interface for registering such thread
pool modules dynamically as well as callback functions at appropriate places.

This worklog serves to implement such interfaces.
Service interfaces
==================

For both interfaces we use C declarations for convenience. This is not
necessarily the way that the implementation actually is done.

my_thread_scheduler
-------------------

::

  /**
    Set the thread scheduler to use for the server.
  
    @param scheduler Pointer to scheduler callbacks to use.
    @retval 0 Scheduler installed correctly.
    @retval 1 Invalid value (NULL) used for scheduler.
  */
  int my_thread_scheduler_set(struct scheduler_functions *scheduler);
  
  /**
    Restore the previous thread scheduler.
  
    @note If no thread scheduler was installed previously with
    thd_set_thread_scheduler, this function will report an error.
  
    @retval 0 Scheduler installed correctly.
    @retval 1 No scheduler installed.
  */
  int my_thread_scheduler_reset();


thd_wait
--------

enum thd_wait_type {
  THD_WAIT_MUTEX= 1,
  THD_WAIT_DISKIO= 2,
  THD_WAIT_ROW_TABLE_LOCK= 3,
  THD_WAIT_GLOBAL_LOCK= 4
};

void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type);
void thd_wait_end(MYSQL_THD thd);