blob: 42f061022d4c2588c5dfd962defce3b9735b762a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* sharedsv.h
*
* Copyright (c) 2001-2002, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
#ifdef USE_ITHREADS
typedef struct {
SV *sv; /* The actual SV */
perl_mutex mutex; /* Our mutex */
perl_cond cond; /* Our condition variable */
perl_cond user_cond; /* For user-level conditions */
IV locks; /* Number of locks held */
PerlInterpreter *owner; /* Who owns the lock? */
U16 index; /* Update index */
} shared_sv;
#define SHAREDSvGET(a) (a->sv)
#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
#define SHAREDSvEDIT(a) STMT_START { \
MUTEX_LOCK(&PL_sharedsv_space_mutex); \
SHAREDSvLOCK((a)); \
PERL_SET_CONTEXT(PL_sharedsv_space); \
} STMT_END
#define SHAREDSvRELEASE(a) STMT_START { \
PERL_SET_CONTEXT((a)->owner); \
SHAREDSvUNLOCK((a)); \
MUTEX_UNLOCK(&PL_sharedsv_space_mutex); \
} STMT_END
#endif /* USE_ITHREADS */
|