Commit a8d8b38
committed
♻️ Decouple context from virtual callback API via unblock_listener
Separate the unblock notification mechanism from the context class into
a dedicated `unblock_listener` interface. This eliminates the need for
virtual function on context itself, allowing each context to be a
simple, concrete object.
The callback pattern is now only used for the unblock event—the only
notification that must happen asynchronously (in ISRs or other threads).
The scheduler can directly inspect context state to determine readiness
and sleep duration without callbacks.
Changes:
- Extract unblock notification into `unblock_listener` interface
- Remove virtual methods from context class
- Update sleep_duration to use microseconds (u32) instead of nanoseconds
to save 4 bytes, reduce the timing requirements on the scheduler, and
to provide a more realistic delay range for most systems.
- Simplify context state inspection for scheduler decision-making
- Add `on_unblock()` listener registration/clearing on context
- Update tests to use new listener-based design1 parent a7e45b7 commit a8d8b38
16 files changed
Lines changed: 975 additions & 632 deletions
File tree
- benchmarks
- docs/api
- modules
- test_package
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | 145 | | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
| |||
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
225 | 236 | | |
226 | 237 | | |
227 | | - | |
| 238 | + | |
| 239 | + | |
228 | 240 | | |
229 | | - | |
230 | | - | |
231 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
232 | 253 | | |
233 | 254 | | |
234 | 255 | | |
| |||
322 | 343 | | |
323 | 344 | | |
324 | 345 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 346 | + | |
365 | 347 | | |
366 | 348 | | |
367 | | - | |
| 349 | + | |
368 | 350 | | |
369 | 351 | | |
370 | 352 | | |
| |||
377 | 359 | | |
378 | 360 | | |
379 | 361 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
384 | 366 | | |
385 | 367 | | |
386 | 368 | | |
387 | | - | |
| 369 | + | |
388 | 370 | | |
389 | 371 | | |
390 | 372 | | |
| |||
577 | 559 | | |
578 | 560 | | |
579 | 561 | | |
580 | | - | |
581 | 562 | | |
582 | 563 | | |
583 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | 274 | | |
290 | 275 | | |
291 | 276 | | |
292 | | - | |
| 277 | + | |
293 | 278 | | |
294 | 279 | | |
295 | 280 | | |
| |||
326 | 311 | | |
327 | 312 | | |
328 | 313 | | |
329 | | - | |
| 314 | + | |
330 | 315 | | |
331 | 316 | | |
332 | 317 | | |
| |||
367 | 352 | | |
368 | 353 | | |
369 | 354 | | |
370 | | - | |
| 355 | + | |
371 | 356 | | |
372 | 357 | | |
373 | 358 | | |
| |||
408 | 393 | | |
409 | 394 | | |
410 | 395 | | |
411 | | - | |
| 396 | + | |
412 | 397 | | |
413 | 398 | | |
414 | 399 | | |
| |||
449 | 434 | | |
450 | 435 | | |
451 | 436 | | |
452 | | - | |
| 437 | + | |
453 | 438 | | |
454 | 439 | | |
455 | 440 | | |
| |||
464 | 449 | | |
465 | 450 | | |
466 | 451 | | |
467 | | - | |
| 452 | + | |
468 | 453 | | |
469 | 454 | | |
470 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
0 commit comments