summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2001-09-22 16:21:05 +0000
committerAbhijit Menon-Sen <ams@wiw.org>2001-09-22 16:21:05 +0000
commit0776ebf09c58b6dd41e996945495d82168d1a73e (patch)
tree1bd3bd22da4c8e6eac3117014ca04167380dae59
parentf758ef9571e52071ed804bfcc93b7c278260ff68 (diff)
downloadperl-0776ebf09c58b6dd41e996945495d82168d1a73e.tar.gz
More cleanups. (What's PERL_DECL_PROT?)
p4raw-id: //depot/perl@12137
-rwxr-xr-xembed.pl12
-rw-r--r--proto.h2
-rw-r--r--sharedsv.h48
3 files changed, 26 insertions, 36 deletions
diff --git a/embed.pl b/embed.pl
index bbb03c3d8d..0e38c1765e 100755
--- a/embed.pl
+++ b/embed.pl
@@ -2188,13 +2188,13 @@ s |void |debprof |OP *o
s |SV* |save_scalar_at |SV **sptr
#endif
-#if defined(USE_ITHREADS) && (defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT))
+#if defined(USE_ITHREADS) || defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT)
Adp |void |sharedsv_init
-Adp |shared_sv* |sharedsv_new
-Adp |shared_sv* |sharedsv_find |SV* sv
-Adp |void |sharedsv_lock |shared_sv* ssv
-Adp |void |sharedsv_unlock |shared_sv* ssv
-p |void |sharedsv_unlock_scope |shared_sv* ssv
+Adp |shared_sv* |sharedsv_new
+Adp |shared_sv* |sharedsv_find |SV* sv
+Adp |void |sharedsv_lock |shared_sv* ssv
+Adp |void |sharedsv_unlock |shared_sv* ssv
+p |void |sharedsv_unlock_scope |shared_sv* ssv
Adp |void |sharedsv_thrcnt_inc |shared_sv* ssv
Adp |void |sharedsv_thrcnt_dec |shared_sv* ssv
#endif
diff --git a/proto.h b/proto.h
index 2c8e8c9c4c..2d763a300b 100644
--- a/proto.h
+++ b/proto.h
@@ -1176,7 +1176,7 @@ STATIC void S_debprof(pTHX_ OP *o);
STATIC SV* S_save_scalar_at(pTHX_ SV **sptr);
#endif
-#if defined(USE_ITHREADS) && (defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT))
+#if defined(USE_ITHREADS) || defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT)
PERL_CALLCONV void Perl_sharedsv_init(pTHX);
PERL_CALLCONV shared_sv* Perl_sharedsv_new(pTHX);
PERL_CALLCONV shared_sv* Perl_sharedsv_find(pTHX_ SV* sv);
diff --git a/sharedsv.h b/sharedsv.h
index bba2210e7f..5a55be632f 100644
--- a/sharedsv.h
+++ b/sharedsv.h
@@ -1,38 +1,28 @@
-
#ifdef USE_ITHREADS
typedef struct {
- SV* sv; /* The actual data */
- perl_mutex mutex; /* Our mutex */
- perl_cond cond; /* Our condition variable */
- perl_cond user_cond; /* For user level conditions */
- IV locks; /* Number of locks held */
- PerlInterpreter* owner; /* who owns the lock */
+ SV *sv; /* The actual SV */
+ perl_mutex mutex; /* Our mutex */
+ perl_cond cond; /* Our condition variable */
+ perl_cond user_cond; /* For user-level conditions */
+ IV locks; /* Number of locks held */
+ PerlInterpreter *owner; /* Who owns the lock? */
} shared_sv;
+#define SHAREDSvGET(a) (a->sv)
+#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
+#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
+#define SHAREDSvEDIT(a) STMT_START { \
+ MUTEX_LOCK(&PL_sharedsv_space_mutex); \
+ SHAREDSvLOCK((a)); \
+ PERL_SET_CONTEXT(PL_sharedsv_space); \
+ } STMT_END
-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) { MUTEX_LOCK(&PL_sharedsv_space_mutex);\
-SHAREDSvLOCK((a));\
-PERL_SET_CONTEXT(PL_sharedsv_space);\
-}
-#define SHAREDSvRELEASE(a) { PERL_SET_CONTEXT((a)->owner);\
-SHAREDSvUNLOCK((a));\
-MUTEX_UNLOCK(&PL_sharedsv_space_mutex);\
-}
-#define SHAREDSvLOCK(a) Perl_sharedsv_lock(aTHX_ a)
-#define SHAREDSvUNLOCK(a) Perl_sharedsv_unlock(aTHX_ a)
+#define SHAREDSvRELEASE(a) STMT_START { \
+ PERL_SET_CONTEXT((a)->owner); \
+ SHAREDSvUNLOCK((a)); \
+ MUTEX_UNLOCK(&PL_sharedsv_space_mutex); \
+ } STMT_END
#endif /* USE_ITHREADS */
-