Your IP : 3.149.244.92


Current Path : /opt/alt/python27/lib64/python2.7/multiprocessing/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyc

�
^
bc@s�ddlZddlZddlZddlmZmZddlmZmZdddddd	gZ	iej
d
6ejd6ejd6ej
d
6ejd6ejd6ejd6ejd6ejd6ejd6ejd6Zyejed<Wnek
rnXd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Z d�Z!d�Z"d Z#iZ$ej%�Z&d!e'fd"��YZ(d#e(fd$��YZ)d%e(fd&��YZ*d'e*fd(��YZ+dS()i����N(theaptRLock(tassert_spawningtForkingPicklertRawValuetRawArraytValuetArraytcopytsynchronizedtctbtBthtHtitItltLtftdtucCs.tj|�}tj|�}t||d�S(N(tctypestsizeofRt
BufferWrappert
rebuild_ctypetNone(ttype_tsizetwrapper((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt
_new_valueBscGsTtj||�}t|�}tjtj|�dtj|��|j|�|S(s>
    Returns a ctypes object allocated from shared memory
    i(ttypecode_to_typetgetRRtmemsett	addressofRt__init__(ttypecode_or_typetargsRtobj((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRGs
%
cCs�tj||�}t|ttf�rf||}t|�}tjtj|�dtj	|��|S|t
|�}t|�}|j|�|SdS(s=
    Returns a ctypes array allocated from shared memory
    iN(RR t
isinstancetinttlongRRR!R"RtlenR#(R$tsize_or_initializerRR&tresult((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRQs
%
cOs�|jdd�}|r1td|j���nt||�}|tkrP|S|tdfkrnt�}nt|d�s�t	d|��nt
||�S(s6
    Return a synchronization wrapper for a Value
    tlocks$unrecognized keyword argument(s): %stacquires'%r' has no method 'acquire'N(tpopRt
ValueErrortkeysRtFalsetTrueRthasattrtAttributeErrorR	(R$R%tkwdsR-R&((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRascKs�|jdd�}|r1td|j���nt||�}|tkrP|S|tdfkrnt�}nt|d�s�t	d|��nt
||�S(s9
    Return a synchronization wrapper for a RawArray
    R-s$unrecognized keyword argument(s): %sR.s'%r' has no method 'acquire'N(R/RR0R1RR2R3RR4R5R	(R$R+R6R-R&((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRqscCs)tt|��}|tj|�d<|S(Ni(RttypeRtpointer(R&tnew_obj((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR�scCst|t�std��t|tj�r;t||�St|tj�ry|jtjkrlt	||�St
||�St|�}yt|}Wnqt
k
rg|jD]}|d^q�}td�|D��}d|j}t|tf|�}t|<nX|||�SdS(Nsobject already synchronizedicss!|]}|t|�fVqdS(N(t
make_property(t.0tname((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pys	<genexpr>�stSynchronized(R'tSynchronizedBasetAssertionErrorRt_SimpleCDataR=Rt_type_tc_chartSynchronizedStringtSynchronizedArrayR7tclass_cachetKeyErrort_fields_tdictt__name__(R&R-tclstsclstfieldtnamesRt	classname((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR	�s 



 
!cCsXt|�t|tj�r8t|j|j|jffStt|�|jdffSdS(N(
RR'RRRRAt_wrappert_length_R7R(R&((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pytreduce_ctype�s
cCsK|dk	r||}ntj|t�|j|j��}||_|S(N(RRtregisterRQtfrom_addresstget_addressRO(RRtlengthR&((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR�s
	cBsPye|SWn=ek
rKi}e|fd|U||e|<||SXdS(Ni(t
prop_cacheRFttemplate(R<R((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR:�s
s�
def get%s(self):
    self.acquire()
    try:
        return self._obj.%s
    finally:
        self.release()
def set%s(self, value):
    self.acquire()
    try:
        self._obj.%s = value
    finally:
        self.release()
%s = property(get%s, set%s)
R>cBs8eZdd�Zd�Zd�Zd�Zd�ZRS(cCs=||_|pt�|_|jj|_|jj|_dS(N(t_objRt_lockR.trelease(tselfR&R-((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR#�s	cCs t|�t|j|jffS(N(RR	RXRY(R[((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt
__reduce__�s
cCs|jS(N(RX(R[((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pytget_obj�scCs|jS(N(RY(R[((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pytget_lock�scCsdt|�j|jfS(Ns<%s wrapper for %s>(R7RIRX(R[((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__repr__�sN(RIt
__module__RR#R\R]R^R_(((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR>�s
			R=cBseZed�ZRS(tvalue(RIR`R:Ra(((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyR=�sRDcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs
t|j�S(N(R*RX(R[((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__len__�scCs+|j�z|j|SWd|j�XdS(N(R.RXRZ(R[R((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__getitem__�s
cCs-|j�z||j|<Wd|j�XdS(N(R.RXRZ(R[RRa((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__setitem__�s
cCs.|j�z|j||!SWd|j�XdS(N(R.RXRZ(R[tstarttstop((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__getslice__�s
cCs0|j�z||j||+Wd|j�XdS(N(R.RXRZ(R[ReRftvalues((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt__setslice__s
(RIR`RbRcRdRgRi(((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRD�s
				RCcBs eZed�Zed�ZRS(Ratraw(RIR`R:RaRj(((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyRC
s(,tsysRtweakreftmultiprocessingRRtmultiprocessing.forkingRRt__all__RBtc_bytetc_ubytetc_shorttc_ushorttc_inttc_uinttc_longtc_ulongtc_floattc_doubleRtc_wcharR5RRRRRRRR	RQRR:RWRVtWeakKeyDictionaryREtobjectR>R=RDRC(((sA/opt/alt/python27/lib64/python2.7/multiprocessing/sharedctypes.pyt<module>#sB

		
							"

?>