This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(Retracted by #12185)
[perl5.git] / sharedsv.h
CommitLineData
cd1ee231
JH
1
2#ifdef USE_ITHREADS
3
4typedef struct {
5 SV* sv; /* The actual data */
6 perl_mutex mutex; /* Our mutex */
7 perl_cond cond; /* Our condition variable */
39696b0c 8 perl_cond user_cond; /* For user level conditions */
cd1ee231
JH
9 IV locks; /* Number of locks held */
10 PerlInterpreter* owner; /* who owns the lock */
11} shared_sv;
12
4f896ddc 13
cd1ee231
JH
14
15void Perl_sharedsv_unlock_scope(pTHX_ shared_sv* ssv);
16void Perl_sharedsv_unlock(pTHX_ shared_sv* ssv);
17void Perl_sharedsv_lock(pTHX_ shared_sv* ssv);
18void Perl_sharedsv_init(pTHX);
19shared_sv* Perl_sharedsv_new(pTHX);
20shared_sv* Perl_sharedsv_find(pTHX_ SV* sv);
21void Perl_sharedsv_thrcnt_inc(pTHX_ shared_sv* ssv);
22void Perl_sharedsv_thrcnt_dec(pTHX_ shared_sv* ssv);
23
24
25#define SHAREDSvGET(a) (a->sv)
4f896ddc 26#define SHAREDSvEDIT(a) { MUTEX_LOCK(&PL_sharedsv_space_mutex);\
667883b0 27SHAREDSvLOCK((a));\
4f896ddc 28PERL_SET_CONTEXT(PL_sharedsv_space);\
667883b0
AB
29}
30#define SHAREDSvRELEASE(a) { PERL_SET_CONTEXT((a)->owner);\
31SHAREDSvUNLOCK((a));\
4f896ddc 32MUTEX_UNLOCK(&PL_sharedsv_space_mutex);\
667883b0 33}
cd1ee231
JH
34#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
35#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
36
37#endif /* USE_ITHREADS */
38