Projects
Browse Source     Search     Timeline     Wiki

Changeset 23578

Show
Ignore:
Timestamp:
2008-03-27 15:48:06 (7 months ago)
Author:
zarzycki@…
Message:

Last minute changes.

Location:
trunk/launchd/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/libvproc.c

    r23577 r23578  
    9393_basic_vproc_transaction_begin(void) 
    9494{ 
    95         int64_t newval; 
     95        typeof(vproc_shmem->vp_shmem_transaction_cnt) newval; 
    9696 
    9797        if (unlikely(vproc_shmem == NULL)) { 
     
    115115} 
    116116 
     117size_t 
     118_basic_vproc_transaction_count(void) 
     119{ 
     120        return likely(vproc_shmem) ? vproc_shmem->vp_shmem_transaction_cnt : INT32_MAX; 
     121} 
     122 
     123void 
     124_basic_vproc_transaction_try_exit(int status) 
     125{ 
     126        typeof(vproc_shmem->vp_shmem_transaction_cnt) newval; 
     127 
     128        if (unlikely(vproc_shmem == NULL)) { 
     129                return; 
     130        } 
     131 
     132        vproc_shmem->vp_shmem_flags |= VPROC_SHMEM_EXITING; 
     133 
     134        newval = __sync_sub_and_fetch(&vproc_shmem->vp_shmem_transaction_cnt, 1); 
     135 
     136        if (newval < 0) { 
     137                _exit(status); 
     138        } 
     139} 
     140 
    117141void 
    118142vproc_transaction_end(vproc_t vp __attribute__((unused)), vproc_transaction_t vpt) 
     
    129153_basic_vproc_transaction_end(void) 
    130154{ 
    131         int32_t newval = __sync_sub_and_fetch(&vproc_shmem->vp_shmem_transaction_cnt, 1); 
     155        typeof(vproc_shmem->vp_shmem_transaction_cnt) newval; 
     156 
     157        newval = __sync_sub_and_fetch(&vproc_shmem->vp_shmem_transaction_cnt, 1); 
    132158 
    133159        if (unlikely(newval < 0)) { 
     
    146172{ 
    147173        vproc_standby_t vpsb = (vproc_standby_t)vproc_shmem_init; /* we need a "random" variable that is testable */ 
    148         int64_t newval; 
     174        typeof(vproc_shmem->vp_shmem_standby_cnt) newval; 
    149175 
    150176        if (unlikely(vproc_shmem == NULL)) { 
     
    168194vproc_standby_end(vproc_t vp __attribute__((unused)), vproc_standby_t vpt) 
    169195{ 
    170         int32_t newval; 
     196        typeof(vproc_shmem->vp_shmem_standby_cnt) newval; 
    171197 
    172198        if (unlikely(vpt != (vproc_standby_t)vproc_shmem_init)) { 
  • trunk/launchd/src/libvproc_private.h

    r23574 r23578  
    7979void _basic_vproc_transaction_begin(void); 
    8080void _basic_vproc_transaction_end(void); 
     81size_t _basic_vproc_transaction_count(void); 
     82void _basic_vproc_transaction_try_exit(int status); 
     83 
    8184 
    8285#pragma GCC visibility pop