diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-13 12:45:21 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-13 12:45:21 +0000 |
commit | cd1ee231f67664d7a2f2d53512a707d2736dbb0e (patch) | |
tree | 26d3be9ce06d827160183cf5272c57670329c2cb /sharedsv.h | |
parent | f3faeb53b75c95d2773d14d859d4fa9ca1594daa (diff) | |
download | perl-cd1ee231f67664d7a2f2d53512a707d2736dbb0e.tar.gz |
[PATHC] sharedsv.[c|h]
From: "Artur Bergman" <artur@contiller.se>
Date: Mon, 13 Aug 2001 14:38:41 +0200
Message-ID: <005401c123f4$e1f53360$21000a0a@vogw2kdev>
Subject: [PATCH] embed.pl
From: Arthur Bergman <arthur@contiller.se>
Date: Mon, 13 Aug 2001 14:38:14 +0200
Message-ID: <B79D96D6.3088%arthur@contiller.se>
Subject: [PATCH] sharedsv cleanups
From: "Arthur Bergman" <arthur@contiller.se>
Date: Mon, 13 Aug 2001 15:14:25 +0200
Message-ID: <005a01c123f9$dfe525d0$21000a0a@vogw2kdev>
Plus few tweaks: _init needs to be Adp, the prototypes
should not be revealed unless using ithreads, #endif FOO
must be #endif /* FOO */, adding (parentheses) around
do { } while doesn't work too well.
p4raw-id: //depot/perl@11659
Diffstat (limited to 'sharedsv.h')
-rw-r--r-- | sharedsv.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sharedsv.h b/sharedsv.h new file mode 100644 index 0000000000..16bba11841 --- /dev/null +++ b/sharedsv.h @@ -0,0 +1,31 @@ + +#ifdef USE_ITHREADS + +typedef struct { + SV* sv; /* The actual data */ + perl_mutex mutex; /* Our mutex */ + perl_cond cond; /* Our condition variable */ + IV locks; /* Number of locks held */ + PerlInterpreter* owner; /* who owns the lock */ +} shared_sv; + +extern PerlInterpreter* sharedsv_space; + +void Perl_sharedsv_unlock_scope(pTHX_ shared_sv* ssv); +void Perl_sharedsv_unlock(pTHX_ shared_sv* ssv); +void Perl_sharedsv_lock(pTHX_ shared_sv* ssv); +void Perl_sharedsv_init(pTHX); +shared_sv* Perl_sharedsv_new(pTHX); +shared_sv* Perl_sharedsv_find(pTHX_ SV* sv); +void Perl_sharedsv_thrcnt_inc(pTHX_ shared_sv* ssv); +void Perl_sharedsv_thrcnt_dec(pTHX_ shared_sv* ssv); + + +#define SHAREDSvGET(a) (a->sv) +#define SHAREDSvEDIT(a) PERL_SET_CONTEXT(sharedsv_space) +#define SHAREDSvRELEASE(a) PERL_SET_CONTEXT(my_perl) +#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a) +#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a) + +#endif /* USE_ITHREADS */ + |