4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHyun Kim <jh8212.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
25 #if !defined(_CPOOL_CLASS_H_)
26 #define _CPOOL_CLASS_H_
30 class cpool : public cmutex
33 static cpool *get_instance();
34 static cpool *current_instance();
36 bool put(char *name, void *data, void (*cb_del)(void *data) = NULL);
37 void *get(char *name);
38 bool del(char *name, bool remove = true);
40 void release_instance(void);
46 struct item_t : public clist {
48 unsigned long name_hash;
50 void (*cb_del)(void *data);
56 static cpool *m_instance;
57 static int m_ref_count;
58 static cmutex m_ref_lock;
60 item_t *search_item(char *name);