File: Broken/Core/BrokenScheduler.py
¶
Broken.Core.BrokenScheduler ¶
precise ¶
precise(sleep: float, *, error: float = 0.001) -> None
A precise alternative of time.sleep(), low cpu near-end thread spin. Increases CPU usage.
Source code in Broken/Core/BrokenScheduler.py
13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
SchedulerTask ¶
Source code in Broken/Core/BrokenScheduler.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
task ¶
task: Callable = None
Function callable to call every synchronization. Automatically sends a 'time' or 'dt' argument if the function's signature contains it
freewheel ¶
freewheel: bool = False
"Rendering" mode, do not sleep on real time, exact virtual frametimes
started ¶
started: float = Factory(lambda: time.absolute())
Time when client was started (initializes $now+started, value in now() seconds)
next_call ¶
next_call: float = None
Next time to call task (initializes $now+next_call, value in now() seconds)
last_call ¶
last_call: float = None
Last time task was called (initializes $now+last_call, value in now() seconds)
__attrs_post_init__ ¶
__attrs_post_init__()
Source code in Broken/Core/BrokenScheduler.py
92 93 94 95 96 97 98 99 |
|
__lt__ ¶
__lt__(other: Self) -> bool
Source code in Broken/Core/BrokenScheduler.py
129 130 131 132 |
|
__gt__ ¶
__gt__(other: Self) -> bool
Source code in Broken/Core/BrokenScheduler.py
134 135 136 137 |
|
next ¶
next(block: bool = True) -> Self
Source code in Broken/Core/BrokenScheduler.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
BrokenScheduler ¶
Source code in Broken/Core/BrokenScheduler.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
add ¶
add(task: SchedulerTask) -> SchedulerTask
Adds a task to the scheduler with immediate next call
Source code in Broken/Core/BrokenScheduler.py
192 193 194 195 |
|
new ¶
new(task: Callable, **options) -> SchedulerTask
Add a new task to the scheduler
Source code in Broken/Core/BrokenScheduler.py
197 198 199 |
|
once ¶
once(task: Callable, **options) -> SchedulerTask
Add a new task that shall only run once and immediately
Source code in Broken/Core/BrokenScheduler.py
201 202 203 |
|
delete ¶
delete(task: SchedulerTask) -> None
Removes a task from the scheduler
Source code in Broken/Core/BrokenScheduler.py
205 206 207 |
|
clear ¶
clear() -> None
Removes all tasks
Source code in Broken/Core/BrokenScheduler.py
209 210 211 |
|
next ¶
next(block=True) -> Optional[SchedulerTask]
Source code in Broken/Core/BrokenScheduler.py
235 236 237 238 239 240 241 242 |
|
all_once ¶
all_once() -> None
Calls all 'once' clients. Useful for @partial calls on the main thread
Source code in Broken/Core/BrokenScheduler.py
244 245 246 247 248 249 |
|