$VERSION "a5" doesn't quite work.
[p5sagit/p5-mst-13.2.git] / sharedsv.h
CommitLineData
cd1ee231 1#ifdef USE_ITHREADS
2
3typedef struct {
0776ebf0 4 SV *sv; /* The actual SV */
5 perl_mutex mutex; /* Our mutex */
6 perl_cond cond; /* Our condition variable */
7 perl_cond user_cond; /* For user-level conditions */
8 IV locks; /* Number of locks held */
9 PerlInterpreter *owner; /* Who owns the lock? */
55fc11ad 10 U16 index; /* Update index */
cd1ee231 11} shared_sv;
12
0776ebf0 13#define SHAREDSvGET(a) (a->sv)
14#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
15#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
4f896ddc 16
0776ebf0 17#define SHAREDSvEDIT(a) STMT_START { \
18 MUTEX_LOCK(&PL_sharedsv_space_mutex); \
19 SHAREDSvLOCK((a)); \
20 PERL_SET_CONTEXT(PL_sharedsv_space); \
21 } STMT_END
cd1ee231 22
0776ebf0 23#define SHAREDSvRELEASE(a) STMT_START { \
24 PERL_SET_CONTEXT((a)->owner); \
25 SHAREDSvUNLOCK((a)); \
26 MUTEX_UNLOCK(&PL_sharedsv_space_mutex); \
27 } STMT_END
cd1ee231 28
29#endif /* USE_ITHREADS */