WL#3984: Revise locking of mysql.general_log and mysql.slow_log

Affects: Server-5.1   —   Status: Complete

This Work Log entry details changes in the architecture / design implemented
with the fix for BUG#25422 (Hang with log tables).

This is not a new feature, but rework on an existing feature (log tables),
introduced by WL#1019.

Problem:

The LOGGER class in 5.1 introduced fake THD objects like:
- Log_to_csv_event_handler::general_log_thd
- Log_to_csv_event_handler::slow_log_thd
which are not associated to a real thread running in the server,
and implement a special logic for locking mysql.general_log and mysql.slow_log.

This in general cause many integration / architectural issues with the
implementation of other features in the server, and must be revisited.

In particular, see:
- BUG#25422 (Hang with log tables)
- BUG#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
  a deadlock)