Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
sectionlock.h
Go to the documentation of this file.
1/*
2 sectionlock.h - mutex state handle
3
4 Copyright (C)
5 2008, Christian Thaeter <ct@pipapo.org>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11*/
12
13
18#ifndef LUMIERA_SECTIONLOCK_H
19#define LUMIERA_SECTIONLOCK_H
20
21#include <pthread.h>
22#include <nobug.h>
23
24
25typedef void
26(*lumiera_sectionlock_unlock_fn)(void*, struct nobug_flag* flag,
27 struct nobug_resource_user** handle,
28 const struct nobug_context ctx);
29
40typedef struct lumiera_sectionlock_struct lumiera_sectionlock;
41typedef struct lumiera_sectionlock_struct* LumieraSectionlock;
42
43/* helper function for nobug */
44static inline void
45lumiera_sectionlock_ensureunlocked (LumieraSectionlock self)
46{
47 ENSURE (!self->lock, "forgot to unlock");
48}
49
50
57#define LUMIERA_SECTION_UNLOCK_(section) \
58 do if ((section)->lock) \
59 { \
60 (section)->unlock((section)->lock, (section)->flag, \
61 &(section)->rh, NOBUG_CONTEXT); \
62 (section)->lock = NULL; \
63 } while (0)
64
65
66#endif
67/*
68// Local Variables:
69// mode: C
70// c-file-style: "gnu"
71// indent-tabs-mode: nil
72// End:
73*/
void(* lumiera_sectionlock_unlock_fn)(void *, struct nobug_flag *flag, struct nobug_resource_user **handle, const struct nobug_context ctx)
Definition sectionlock.h:26
static void lumiera_sectionlock_ensureunlocked(LumieraSectionlock self)
Definition sectionlock.h:45
sectionlock used to manage the state of mutexes.
Definition sectionlock.h:34
lumiera_sectionlock_unlock_fn unlock
Definition sectionlock.h:36
NOBUG_IF_ALPHA(struct nobug_flag *flag)