This file contains basic synchronization and mutual exclusion functions of PwnOS.
| Sync.asm | This file contains basic synchronization and mutual exclusion functions of PwnOS. |
| Functions | |
| GetLock | This procedure gets a lock’s access for the current thread. |
| ReleaseLock | This procedure releases a lock so that other threads can get it. |
| AttemptGetLock | This procedure attempts to get a lock, but if it cannot get a lock, it gives up after a specified timeout period. |
| WaitForNotify | This procedure makes the current thread wait to be notified on the specified lock. |
| AttemptWaitForNotify | This procedure makes the current thread wait to be notified on the specified lock until a specified timeout period elapses. |
| Notify | This procedure notifies a thread waiting on the specified lock (if there is one). |
| NotifyAll | This procedure notifies all threads waiting on the specified lock (if there are any). |
| Gateway Functions of Sync.asm | |
| Functions | |
| GetLockU | Gateway function for GetLock |
| ReleaseLockU | Gateway function for ReleaseLock |
| AttemptGetLockU | Gateway function for AttemptGetLock |
| WaitForNotifyU | Gateway function for WaitForNotify |
| AttemptWaitForNotifyU | Gateway function for AttemptWaitForNotify |
| NotifyU | Gateway function for Notify |
| NotifyAllU | Gateway function for NotifyAll |
This procedure gets a lock’s access for the current thread. It does not return until the current thread gets the lock.
TODO: Check priorities instead of just putting current thread at beginning of access list, or leave to ReleaseLock
| pLock | address of lock sturcture |
This procedure releases a lock so that other threads can get it.
If the current thread doesn’t have the specified lock, this procedure does nothing.
| pLock | address of lock sturcture |
This procedure attempts to get a lock, but if it cannot get a lock, it gives up after a specified timeout period.
Not Implemented
| pLock | address of lock sturcture |
| timeout | time (in milliseconds) for which to attempt before giving up |
This procedure makes the current thread wait to be notified on the specified lock.
If the current thread doesn’t have the specified lock, this procedure does nothing. The lock is released before going to the thread scheduler.
| pLock | address of lock sturcture |
This procedure makes the current thread wait to be notified on the specified lock until a specified timeout period elapses.
Not Implemented
| pLock | address of lock sturcture |
| timeout | time (in milliseconds) for which to wait before giving up |
This procedure notifies a thread waiting on the specified lock (if there is one).
If the current thread doesn’t have the specified lock or no threads are waiting for notify, this procedure does nothing.
| pLock | address of lock sturcture |
This procedure notifies all threads waiting on the specified lock (if there are any).
If the current thread doesn’t have the specified lock or no threads are waiting for notify, this procedure does nothing.
| pLock | address of lock sturcture |
| Functions | |
| GetLockU | Gateway function for GetLock |
| ReleaseLockU | Gateway function for ReleaseLock |
| AttemptGetLockU | Gateway function for AttemptGetLock |
| WaitForNotifyU | Gateway function for WaitForNotify |
| AttemptWaitForNotifyU | Gateway function for AttemptWaitForNotify |
| NotifyU | Gateway function for Notify |
| NotifyAllU | Gateway function for NotifyAll |
Gateway function for GetLock
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for ReleaseLock
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for AttemptGetLock
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for WaitForNotify
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for AttemptWaitForNotify
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for Notify
This checks that the LOCKSTRUCT isn’t in system space.
Gateway function for NotifyAll
This checks that the LOCKSTRUCT isn’t in system space.