BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

lock.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_LOCK_H__
20#define __PJ_LOCK_H__
21
26#include <pj/types.h>
27
29
55 const char *name,
56 pj_lock_t **lock );
57
68 const char *name,
69 pj_lock_t **lock );
70
71
83 const char *name,
84 pj_lock_t **lock );
85
86
87#if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0
100 const char *name,
101 unsigned initial,
102 unsigned max,
103 pj_lock_t **lock );
104
105#endif /* PJ_HAS_SEMAPHORE */
106
115
116
125
126
135
136
145
146
186typedef struct pj_grp_lock_config
187{
191 unsigned flags;
192
194
195
202typedef void (*pj_grp_lock_handler)(void *member);
203
204
211
225 const pj_grp_lock_config *cfg,
226 pj_grp_lock_t **p_grp_lock);
227
244 const pj_grp_lock_config *cfg,
245 void *member,
246 pj_grp_lock_handler handler,
247 pj_grp_lock_t **p_grp_lock);
248
257
268 pj_grp_lock_t *new_lock);
269
278
288
299
312 pj_pool_t *pool,
313 void *member,
314 pj_grp_lock_handler handler);
315
327 void *member,
328 pj_grp_lock_handler handler);
329
337#if !PJ_GRP_LOCK_DEBUG
339
349#define pj_grp_lock_add_ref_dbg(grp_lock, x, y) pj_grp_lock_add_ref(grp_lock)
350
351#else
352
353#define pj_grp_lock_add_ref(g) pj_grp_lock_add_ref_dbg(g, __FILE__, __LINE__)
354
356 const char *file,
357 int line);
358#endif
359
368#if !PJ_GRP_LOCK_DEBUG
370
380#define pj_grp_lock_dec_ref_dbg(grp_lock, x, y) pj_grp_lock_dec_ref(grp_lock)
381#else
382
383#define pj_grp_lock_dec_ref(g) pj_grp_lock_dec_ref_dbg(g, __FILE__, __LINE__)
384
386 const char *file,
387 int line);
388
389#endif
390
399PJ_DECL(int) pj_grp_lock_get_ref(pj_grp_lock_t *grp_lock);
400
401
410PJ_DECL(void) pj_grp_lock_dump(pj_grp_lock_t *grp_lock);
411
412
431 pj_lock_t *ext_lock,
432 int pos);
433
443 pj_lock_t *ext_lock);
444
445
450
451
452#endif /* __PJ_LOCK_H__ */
453
struct pj_lock_t pj_lock_t
Definition: types.h:239
int pj_status_t
Definition: types.h:68
struct pj_grp_lock_t pj_grp_lock_t
Definition: types.h:242
void pj_grp_lock_config_default(pj_grp_lock_config *cfg)
pj_status_t pj_grp_lock_create_w_handler(pj_pool_t *pool, const pj_grp_lock_config *cfg, void *member, pj_grp_lock_handler handler, pj_grp_lock_t **p_grp_lock)
pj_status_t pj_grp_lock_chain_lock(pj_grp_lock_t *grp_lock, pj_lock_t *ext_lock, int pos)
pj_status_t pj_grp_lock_del_handler(pj_grp_lock_t *grp_lock, void *member, pj_grp_lock_handler handler)
pj_status_t pj_grp_lock_release(pj_grp_lock_t *grp_lock)
pj_status_t pj_grp_lock_add_handler(pj_grp_lock_t *grp_lock, pj_pool_t *pool, void *member, pj_grp_lock_handler handler)
pj_status_t pj_grp_lock_replace(pj_grp_lock_t *old_lock, pj_grp_lock_t *new_lock)
pj_status_t pj_grp_lock_add_ref(pj_grp_lock_t *grp_lock)
void(* pj_grp_lock_handler)(void *member)
Definition: lock.h:202
pj_status_t pj_grp_lock_acquire(pj_grp_lock_t *grp_lock)
int pj_grp_lock_get_ref(pj_grp_lock_t *grp_lock)
#define pj_grp_lock_add_ref_dbg(grp_lock, x, y)
Definition: lock.h:349
pj_status_t pj_grp_lock_unchain_lock(pj_grp_lock_t *grp_lock, pj_lock_t *ext_lock)
pj_status_t pj_grp_lock_destroy(pj_grp_lock_t *grp_lock)
#define pj_grp_lock_dec_ref_dbg(grp_lock, x, y)
Definition: lock.h:380
pj_status_t pj_grp_lock_create(pj_pool_t *pool, const pj_grp_lock_config *cfg, pj_grp_lock_t **p_grp_lock)
void pj_grp_lock_dump(pj_grp_lock_t *grp_lock)
pj_status_t pj_grp_lock_dec_ref(pj_grp_lock_t *grp_lock)
pj_status_t pj_grp_lock_tryacquire(pj_grp_lock_t *grp_lock)
pj_status_t pj_lock_acquire(pj_lock_t *lock)
pj_status_t pj_lock_create_semaphore(pj_pool_t *pool, const char *name, unsigned initial, unsigned max, pj_lock_t **lock)
pj_status_t pj_lock_destroy(pj_lock_t *lock)
pj_status_t pj_lock_create_null_mutex(pj_pool_t *pool, const char *name, pj_lock_t **lock)
pj_status_t pj_lock_create_simple_mutex(pj_pool_t *pool, const char *name, pj_lock_t **lock)
pj_status_t pj_lock_tryacquire(pj_lock_t *lock)
pj_status_t pj_lock_create_recursive_mutex(pj_pool_t *pool, const char *name, pj_lock_t **lock)
pj_status_t pj_lock_release(pj_lock_t *lock)
#define PJ_BEGIN_DECL
Definition: config.h:1284
#define PJ_END_DECL
Definition: config.h:1285
Definition: lock.h:187
unsigned flags
Definition: lock.h:191
Definition: pool.h:310
Declaration of basic types and utility.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.