5306 Vinay Fisrekar 2012-12-28 [merge]
5305 kevin.lewis@stripped 2012-12-27
Bug14762796-THREADEXIT() ON WINDOWS IS CALLED PREMATURELY
WITH HANDLES NOT CLOSED
InnoDB uses os_thread_create() as a pthread implementation.
It pays no attention to what it returns on Windows. That is
because on non-Windows platforms it returns the same value as
the third parameter, the thread_id. If os_thread_create()
actually fails to create a thread it does an exit(1).
So from a *nix perspective, there is no need to check the
But on Windows, the return value is a handle to the thread object.
This system thread object is held open by that handle even after
the thread exits, until the process exits. InnoDB does not close
any os_thread_t handles since it make no attempt to record them.
Until FTS, there was really no need to close these handles because
all threads started by InnoDB live until shutdown.
But FTS introduced some short-lived threads. These threads were
left open until shutdown which was fixed by Bug14759163 by explicitly
closing those threads.
This patch is a general fix for closing Windows thread handles by
allowing os_thread_create() to close it immediately after CreateThread()
starts the thread. The thread object then stays around until the thread
exits. Then instead of returning this closed handle, os_thread_create()
is redesigned to return void, recognizing that InnoDB code never checks
that return value anyway. So the schizophrenic type os_thread_t which
was a thread_id on *nix and a HANDLE on Windows is just deleted.
Approved by Jimmy in RB:1416
No bundle (reason: useless for push emails).
|• bzr push into mysql-trunk branch (vinay.fisrekar:5305 to 5306) ||Vinay Fisrekar||11 Jan|