Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
shared_mem_lock_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef PAGESPEED_KERNEL_SHAREDMEM_SHARED_MEM_LOCK_MANAGER_H_
20 #define PAGESPEED_KERNEL_SHAREDMEM_SHARED_MEM_LOCK_MANAGER_H_
21 
22 #include <cstddef>
23 
30 
31 namespace net_instaweb {
32 
33 class AbstractSharedMem;
34 class AbstractSharedMemSegment;
35 class Hasher;
36 class MessageHandler;
37 class Scheduler;
38 
39 namespace SharedMemLockData {
40 
41 struct Bucket;
42 
43 }
44 
50  public:
56  AbstractSharedMem* shm, const GoogleString& path, Scheduler* scheduler,
57  Hasher* hasher, MessageHandler* handler);
58  virtual ~SharedMemLockManager();
59 
62  bool Initialize();
63 
66  bool Attach();
67 
73  static void GlobalCleanup(AbstractSharedMem* shm, const GoogleString& path,
74  MessageHandler* message_handler);
75 
76  virtual SchedulerBasedAbstractLock* CreateNamedLock(const StringPiece& name);
77 
78  private:
79  friend class SharedMemLock;
80 
81  SharedMemLockData::Bucket* Bucket(size_t bucket);
82 
84  size_t MutexOffset(SharedMemLockData::Bucket*);
85 
86  AbstractSharedMem* shm_runtime_;
87  GoogleString path_;
88 
90  Scheduler* scheduler_;
91  Hasher* hasher_;
92  MessageHandler* handler_;
93  size_t lock_size_;
94 
95 
96 };
97 
98 }
99 
100 #endif
Definition: named_lock_manager.h:82
namespace SharedMemLockData
Definition: shared_mem_lock_manager.h:49
Definition: scoped_ptr.h:30
static void GlobalCleanup(AbstractSharedMem *shm, const GoogleString &path, MessageHandler *message_handler)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
SharedMemLockManager(AbstractSharedMem *shm, const GoogleString &path, Scheduler *scheduler, Hasher *hasher, MessageHandler *handler)
Definition: abstract_shared_mem.h:86
Definition: message_handler.h:39
Definition: scheduler.h:47
Definition: scheduler_based_abstract_lock.h:40
Definition: hasher.h:30