List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:March 12 2009 8:37am
Subject:Re: Is active_index thread safe?
View as plain text  
Hi, Ron!

On Mar 11, Ron Hu wrote:
> Hi Sergei:
> 
> I use mysql-5.1.31 and observe that a table handler is shared by two user
> threads.  Here is my experiment:
... 
> Note that same table handler (value 0x058c8410) is used by two different
> user threads.

But it's not shared between threads. Only your first threads is using it
exclusively. Then it releases it, and the handler object is migrated to
another thread. Then this other thread is using it exclusively. No two
threads can use a handler object at the same time, it wasn't designed
for that.

When ::external_lock was called the handler object is locked by a
thread, no other thread may access it until ::external_lock(F_UNLCK) is
called. After that an object may go to a free pool and be picked up by a
different thread.
 
Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
Is active_index thread safe?Ron Hu11 Mar
  • Re: Is active_index thread safe?Sergei Golubchik11 Mar
    • RE: Is active_index thread safe?Ron Hu11 Mar
      • Re: Is active_index thread safe?MARK CALLAGHAN11 Mar
      • Re: Is active_index thread safe?Sergei Golubchik12 Mar
        • Is handler object shared by two concurrent users?Ron Hu12 Mar
          • Re: Is handler object shared by two concurrent users?Sergei Golubchik16 Mar
            • RE: Is handler object shared by two concurrent users?Ron Hu16 Mar
    • RE: Is active_index thread safe? --ResendRon Hu11 Mar