diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-11-04 14:47:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-11-04 14:47:49 +0000 |
commit | c9f7ac20cc60b6edea0f8aa7d2d3184bb6978820 (patch) | |
tree | 192e5997b0ec472368161087db4e52dab46cf8c2 /pp_sys.c | |
parent | c99a147504afe573a5d485f03e53fd1ac6939325 (diff) | |
download | perl-c9f7ac20cc60b6edea0f8aa7d2d3184bb6978820.tar.gz |
Merge msgsnd, msgrcv with Perl_pp_shmwrite().
"Perfection is achieved not when there's nothing more to add,
but when there's nothing left to remove" (Antoine de Saint-Exupéry)
p4raw-id: //depot/perl@25990
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 41 |
1 files changed, 14 insertions, 27 deletions
@@ -4430,40 +4430,27 @@ PP(pp_sleep) } /* Shared memory. */ +/* Merged with some message passing. */ PP(pp_shmwrite) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) dSP; dMARK; dTARGET; - I32 value = (I32)(do_shmio(PL_op->op_type, MARK, SP) >= 0); - SP = MARK; - PUSHi(value); - RETURN; -#else - return pp_semget(); -#endif -} - -/* Message passing. */ + const int op_type = PL_op->op_type; + I32 value; -PP(pp_msgsnd) -{ -#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; - I32 value = (I32)(do_msgsnd(MARK, SP) >= 0); - SP = MARK; - PUSHi(value); - RETURN; -#else - return pp_semget(); -#endif -} + switch (op_type) { + case OP_MSGSND: + value = (I32)(do_msgsnd(MARK, SP) >= 0); + break; + case OP_MSGRCV: + value = (I32)(do_msgrcv(MARK, SP) >= 0); + break; + default: + value = (I32)(do_shmio(op_type, MARK, SP) >= 0); + break; + } -PP(pp_msgrcv) -{ -#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; - I32 value = (I32)(do_msgrcv(MARK, SP) >= 0); SP = MARK; PUSHi(value); RETURN; |