@@ -26,17 +26,6 @@ internal static void Initialize(IntPtr library, ILibraryLoader loader)
2626 Base . HALSemaphore . GiveMultiWait = giveMultiWait ;
2727 }
2828
29-
30- [ CalledSimFunction ]
31- public static IntPtr initializeMutexRecursive ( )
32- {
33- MUTEX_ID p = new MUTEX_ID { lockObject = new object ( ) } ;
34- IntPtr ptr = Marshal . AllocHGlobal ( Marshal . SizeOf ( p ) ) ;
35- Marshal . StructureToPtr ( p , ptr , true ) ;
36-
37- return ptr ;
38- }
39-
4029 [ CalledSimFunction ]
4130 public static IntPtr initializeMutexNormal ( )
4231 {
@@ -76,50 +65,6 @@ public static void giveMutex(IntPtr sem)
7665 Monitor . Exit ( temp . lockObject ) ;
7766 }
7867
79- [ CalledSimFunction ]
80- public static IntPtr initializeSemaphore ( uint initial_value )
81- {
82- var p = new MULTIWAIT_ID { lockObject = new object ( ) } ;
83- IntPtr ptr = Marshal . AllocHGlobal ( Marshal . SizeOf ( p ) ) ;
84- Marshal . StructureToPtr ( p , ptr , true ) ;
85-
86- return ptr ;
87- }
88-
89-
90- [ CalledSimFunction ]
91- public static void deleteSemaphore ( IntPtr sem )
92- {
93- Marshal . FreeHGlobal ( sem ) ;
94- sem = IntPtr . Zero ;
95- }
96-
97- [ CalledSimFunction ]
98- public static sbyte takeSemaphore ( IntPtr sem )
99- {
100- var temp = ( MULTIWAIT_ID ) Marshal . PtrToStructure ( sem , typeof ( MULTIWAIT_ID ) ) ;
101- Monitor . Enter ( temp . lockObject ) ; //temp.semaphore.WaitOne();
102- return 0 ;
103- }
104-
105- [ CalledSimFunction ]
106- public static sbyte tryTakeSemaphore ( IntPtr sem )
107- {
108- var temp = ( MULTIWAIT_ID ) Marshal . PtrToStructure ( sem , typeof ( MULTIWAIT_ID ) ) ;
109- bool retVal = Monitor . TryEnter ( temp . lockObject ) ;
110-
111- return retVal ? ( sbyte ) 0 : ( sbyte ) 1 ;
112- }
113-
114- [ CalledSimFunction ]
115- public static sbyte giveSemaphore ( IntPtr sem )
116- {
117- var temp = ( MULTIWAIT_ID ) Marshal . PtrToStructure ( sem , typeof ( MULTIWAIT_ID ) ) ;
118- if ( Monitor . IsEntered ( temp . lockObject ) )
119- Monitor . Exit ( temp . lockObject ) ;
120- return 0 ;
121- }
122-
12368 [ CalledSimFunction ]
12469 public static IntPtr initializeMultiWait ( )
12570 {
0 commit comments