forked from lei.chen/myxce
feat: rename delaymgr precision→precision_ms, replace sleep() with nanosleep() (P0-2b)
- Rename `precision` field to `precision_ms` in delaymgr_t struct (delay.h) - Replace `sleep(mgr->precision)` with `nanosleep()` for 10ms granularity (delay.c) - Add `#include <time.h>` to delay.c (already in delay.h) - Update delaymgr_init() to store precision_ms parameter - Update all call sites: cluster.c (2→200ms), controller/testsuite/test.c (2→2000ms), lib/testsuite/test_delay.c (1→1000ms) - Add TDD test test_delaymgr_precision_ms_field verifying field exists and stores correctly - delay_task() delay parameter remains in seconds; only sleep granularity changes
This commit is contained in:
parent
762b59c043
commit
6d4d8eb81d
5 changed files with 23 additions and 6 deletions
|
|
@ -403,7 +403,7 @@ int cmd_worker(int argc, char* argv[])
|
|||
|
||||
active_ctx = &workerctx;
|
||||
|
||||
delaymgr_init(&delaymgr, 2, NULL);
|
||||
delaymgr_init(&delaymgr, 2000 /* precision_ms */, NULL);
|
||||
delaymgr_start(&delaymgr);
|
||||
delay_task(&delaymgr, 5, -1, (delay_task_entry_fn_t)worker_house_keeping,
|
||||
&workerctx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue