This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow the threads extension to be found if present.
[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 */
8 IV locks; /* Number of locks held */
9 PerlInterpreter* owner; /* who owns the lock */
10} shared_sv;
11
12extern PerlInterpreter* sharedsv_space;
13
14void Perl_sharedsv_unlock_scope(pTHX_ shared_sv* ssv);
15void Perl_sharedsv_unlock(pTHX_ shared_sv* ssv);
16void Perl_sharedsv_lock(pTHX_ shared_sv* ssv);
17void Perl_sharedsv_init(pTHX);
18shared_sv* Perl_sharedsv_new(pTHX);
19shared_sv* Perl_sharedsv_find(pTHX_ SV* sv);
20void Perl_sharedsv_thrcnt_inc(pTHX_ shared_sv* ssv);
21void Perl_sharedsv_thrcnt_dec(pTHX_ shared_sv* ssv);
22
23
24#define SHAREDSvGET(a) (a->sv)
25#define SHAREDSvEDIT(a) PERL_SET_CONTEXT(sharedsv_space)
26#define SHAREDSvRELEASE(a) PERL_SET_CONTEXT(my_perl)
27#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
28#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
29
30#endif /* USE_ITHREADS */
31