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