equal
deleted
inserted
replaced
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
1 <?xml version='1.0' encoding='utf-8'?> |
2 <CFile> |
2 <CFile xmlns:xhtml="http://www.w3.org/1999/xhtml"> |
3 <includes> |
3 <includes> |
4 <![CDATA[ |
4 <xhtml:p><![CDATA[ |
5 ]]> |
5 ]]></xhtml:p> |
6 </includes> |
6 </includes> |
7 <variables> |
7 <variables> |
8 <variable name="TestInput" type="SINT" initial="0"/> |
8 <variable name="TestInput" type="SINT" initial="0"/> |
9 <variable name="TestOutput" type="SINT"/> |
9 <variable name="TestOutput" type="SINT"/> |
10 </variables> |
10 </variables> |
11 <globals> |
11 <globals> |
12 <![CDATA[ |
12 <xhtml:p><![CDATA[ |
13 volatile long Lock=0; |
13 volatile long Lock=0; |
14 volatile char PtoC=1,CtoP=2; |
14 volatile char PtoC=1,CtoP=2; |
15 |
15 |
16 extern long AtomicCompareExchange(long*,long, long); |
16 extern long AtomicCompareExchange(long*,long, long); |
17 |
17 |
46 AtomicCompareExchange((long*)&Lock, 1, 0); |
46 AtomicCompareExchange((long*)&Lock, 1, 0); |
47 return 1; |
47 return 1; |
48 } |
48 } |
49 return 0; |
49 return 0; |
50 } |
50 } |
51 ]]> |
51 ]]></xhtml:p> |
52 </globals> |
52 </globals> |
53 <initFunction> |
53 <initFunction> |
54 <![CDATA[ |
54 <xhtml:p><![CDATA[ |
55 ]]> |
55 ]]></xhtml:p> |
56 </initFunction> |
56 </initFunction> |
57 <cleanUpFunction> |
57 <cleanUpFunction> |
58 <![CDATA[ |
58 <xhtml:p><![CDATA[ |
59 ]]> |
59 ]]></xhtml:p> |
60 </cleanUpFunction> |
60 </cleanUpFunction> |
61 <retrieveFunction> |
61 <retrieveFunction> |
62 <![CDATA[ |
62 <xhtml:p><![CDATA[ |
63 ]]> |
63 ]]></xhtml:p> |
64 </retrieveFunction> |
64 </retrieveFunction> |
65 <publishFunction> |
65 <publishFunction> |
66 <![CDATA[ |
66 <xhtml:p><![CDATA[ |
67 if(!AtomicCompareExchange((long*)&Lock, 0, 1)){ |
67 if(!AtomicCompareExchange((long*)&Lock, 0, 1)){ |
68 TestInput = CtoP + PtoC + TestOutput; |
68 TestInput = CtoP + PtoC + TestOutput; |
69 AtomicCompareExchange((long*)&Lock, 1, 0); |
69 AtomicCompareExchange((long*)&Lock, 1, 0); |
70 } |
70 } |
71 ]]> |
71 ]]></xhtml:p> |
72 </publishFunction> |
72 </publishFunction> |
73 </CFile> |
73 </CFile> |