BadScript 2
Loading...
Searching...
No Matches
BadLockList.cs
Go to the documentation of this file.
3
5
9public class BadLockList
10{
14 public static readonly BadLockList Instance = new BadLockList();
15
19 private readonly List<BadObject> m_LockList = new List<BadObject>();
20
21 private BadLockList() { }
22
28 public bool TryAquire(BadObject lockObj)
29 {
30 lock (m_LockList)
31 {
32 if (m_LockList.Contains(lockObj))
33 {
34 return false;
35 }
36
37 m_LockList.Add(lockObj);
38
39 return true;
40 }
41 }
42
48 public void Release(BadObject lockObj)
49 {
50 lock (m_LockList)
51 {
52 if (!m_LockList.Contains(lockObj))
53 {
54 throw new BadRuntimeException("Lock was not properly aquired!");
55 }
56
57 m_LockList.Remove(lockObj);
58 }
59 }
60}
The Lock List that is used to store all locks.
static readonly BadLockList Instance
Instance of the Lock List.
bool TryAquire(BadObject lockObj)
Tries to aquire a lock on the given object.
void Release(BadObject lockObj)
Releases the lock on the given object.
readonly List< BadObject > m_LockList
Inner List that is used to store the Locks.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
Contains the Locking Expressions for the BadScript2 Language.
Contains the Error Objects for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10