Commit | Line | Data |
cd1ee231 |
1 | #ifdef USE_ITHREADS |
2 | |
3 | typedef 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? */ |
cd1ee231 |
10 | } shared_sv; |
11 | |
0776ebf0 |
12 | #define SHAREDSvGET(a) (a->sv) |
13 | #define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a) |
14 | #define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a) |
4f896ddc |
15 | |
0776ebf0 |
16 | #define SHAREDSvEDIT(a) STMT_START { \ |
17 | MUTEX_LOCK(&PL_sharedsv_space_mutex); \ |
18 | SHAREDSvLOCK((a)); \ |
19 | PERL_SET_CONTEXT(PL_sharedsv_space); \ |
20 | } STMT_END |
cd1ee231 |
21 | |
0776ebf0 |
22 | #define SHAREDSvRELEASE(a) STMT_START { \ |
23 | PERL_SET_CONTEXT((a)->owner); \ |
24 | SHAREDSvUNLOCK((a)); \ |
25 | MUTEX_UNLOCK(&PL_sharedsv_space_mutex); \ |
26 | } STMT_END |
cd1ee231 |
27 | |
28 | #endif /* USE_ITHREADS */ |