Rev 9709 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9709 | Rev 9715 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Synhronization for MenuetOS. ;; |
6 | ;; Synhronization for MenuetOS. ;; |
7 | ;; Author: Halyavin Andrey, halyavin@land.ru ;; |
7 | ;; Author: Halyavin Andrey, halyavin@land.ru ;; |
8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 10... | Line 10... | ||
10 | $Revision: 9709 $ |
10 | $Revision: 9715 $ |
11 | 11 | ||
Line 268... | Line 268... | ||
268 | sti |
268 | sti |
269 | call change_task |
269 | call change_task |
270 | jmp start_wait |
270 | jmp start_wait |
271 | ok=$ |
271 | ok=$ |
272 | push eax |
272 | push eax |
273 | mov eax, dword [TASK_BASE+second_base_address] |
273 | mov eax, dword [current_slot] |
274 | mov eax, [eax+TASKDATA.pid] |
274 | mov eax, [eax + APPDATA.tid] |
275 | mov [name], eax |
275 | mov [name], eax |
276 | pop eax |
276 | pop eax |
277 | sti |
277 | sti |
278 | } |
278 | } |
279 | macro ReleaseSimpleMutex name |
279 | macro ReleaseSimpleMutex name |
Line 302... | Line 302... | ||
302 | } |
302 | } |
303 | macro WaitSimpleCriticalSection name |
303 | macro WaitSimpleCriticalSection name |
304 | { |
304 | { |
305 | local start_wait,first_wait,inc_counter,end_wait |
305 | local start_wait,first_wait,inc_counter,end_wait |
306 | push eax |
306 | push eax |
307 | mov eax, [TASK_BASE+second_base_address] |
307 | mov eax, [current_slot] |
308 | mov eax, [eax+TASKDATA.pid] |
308 | mov eax, [eax + APPDATA.tid] |
309 | start_wait=$ |
309 | start_wait=$ |
310 | cli |
310 | cli |
311 | cmp [name], dword 0 |
311 | cmp [name], dword 0 |
312 | jz first_wait |
312 | jz first_wait |
313 | cmp [name], eax |
313 | cmp [name], eax |
Line 334... | Line 334... | ||
334 | release_end=$ |
334 | release_end=$ |
335 | } |
335 | } |
336 | macro TryWaitSimpleCriticalSection name ;result in eax and in flags |
336 | macro TryWaitSimpleCriticalSection name ;result in eax and in flags |
337 | { |
337 | { |
338 | local ok,try_end |
338 | local ok,try_end |
339 | mov eax, [CURRENT_TASK+second_base_address] |
339 | mov eax, [current_slot] |
340 | mov eax, [eax+TASKDATA.pid] |
340 | mov eax, [eax + APPDATA.tid] |
341 | cmp [name], eax |
341 | cmp [name], eax |
342 | jz ok |
342 | jz ok |
343 | cmp [name], 0 |
343 | cmp [name], 0 |
344 | jz ok |
344 | jz ok |
345 | xor eax, eax |
345 | xor eax, eax |