~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/cache.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-13 10:38:28 UTC
  • mto: (2277.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2278.
  • Revision ID: olafvdspek@gmail.com-20110413103828-zpiii4c7j79k6soe
Remove table::Cache::singleton()

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
CacheMap& getCache()
45
45
{
46
 
  return Cache::singleton().getCache();
 
46
  return Cache::getCache();
47
47
}
48
48
 
49
49
/*
54
54
  entry         Table to remove
55
55
 
56
56
  NOTE
57
 
  We need to have a lock on table::Cache::singleton().mutex() when calling this
 
57
  We need to have a lock on table::Cache::mutex() when calling this
58
58
*/
59
59
 
60
60
static void free_cache_entry(table::Concurrent *table)
162
162
  close_thread_tables() is called.
163
163
 
164
164
  PREREQUISITES
165
 
  Lock on table::Cache::singleton().mutex()()
 
165
  Lock on table::Cache::mutex()()
166
166
 
167
167
  RETURN
168
168
  0  This thread now have exclusive access to this table and no other thread
209
209
        /*
210
210
          Now we must abort all tables locks used by this thread
211
211
          as the thread may be waiting to get a lock for another table.
212
 
          Note that we need to hold table::Cache::singleton().mutex() while going through the
 
212
          Note that we need to hold table::Cache::mutex() while going through the
213
213
          list. So that the other thread cannot change it. The other
214
 
          thread must also hold table::Cache::singleton().mutex() whenever changing the
 
214
          thread must also hold table::Cache::mutex() whenever changing the
215
215
          open_tables list. Aborting the MERGE lock after a child was
216
216
          closed and before the parent is closed would be fatal.
217
217
        */
247
247
        dropping_tables++;
248
248
        if (likely(signalled))
249
249
        {
250
 
          boost_unique_lock_t scoped(table::Cache::singleton().mutex(), boost::adopt_lock_t());
 
250
          boost_unique_lock_t scoped(table::Cache::mutex(), boost::adopt_lock_t());
251
251
          COND_refresh.wait(scoped);
252
252
          scoped.release();
253
253
        }
261
261
            ensure that the thread actually hears our signal
262
262
            before we go to sleep. Thus we wait for a short time
263
263
            and then we retry another loop in the
264
 
            table::Cache::singleton().removeTable routine.
 
264
            table::Cache::removeTable routine.
265
265
          */
266
266
          boost::xtime xt;
267
267
          xtime_get(&xt, boost::TIME_UTC);
268
268
          xt.sec += 10;
269
 
          boost_unique_lock_t scoped(table::Cache::singleton().mutex(), boost::adopt_lock_t());
 
269
          boost_unique_lock_t scoped(table::Cache::mutex(), boost::adopt_lock_t());
270
270
          COND_refresh.timed_wait(scoped, xt);
271
271
          scoped.release();
272
272
        }