5 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 3e5e84e391 mruby-task: update README and headers for ports-based HAL layout
The HAL was integrated into mruby-task/ports/{posix,win}/ in
be6413f0d8 and the function names were updated in 610ff67906, but
the docs and one header still described the old separate-gem layout:

  - mrbgems/mruby-task/README.md described hal-posix-task and
    hal-win-task as separate gems, used the pre-rename function
    names (mrb_task_hal_*), and omitted mrb_hal_task_sleep_us.
    Rewrote the HAL section to match the current ports/ model.

  - mrbgems/mruby-task/include/task.h had three orphan declarations
    (mrb_task_hal_init / _final / _idle_cpu) from before the
    rename. Removed; the real declarations are in task_hal.h.

  - mrbgems/mruby-task/include/task_hal.h had a comment referring
    to the removed hal-* gems.

  - doc/guides/amalgamation.md listed hal-posix-io and hal-posix-task
    as platform-specific gems alongside mruby-io and mruby-task; both
    are now ports under the parent gem.

Reported by Asmod4n in #6825.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-14 13:48:55 +09:00
Yukihiro "Matz" Matsumoto 610ff67906 HAL: rename functions to mrb_hal_<feature>_<name> convention
rename all HAL functions from mrb_<feature>_hal_<name>() to
mrb_hal_<feature>_<name>() for better grouping and clarity. this makes all
HAL functions immediately identifiable with the mrb_hal_* prefix.

affected gems:
- mruby-task: mrb_task_hal_* -> mrb_hal_task_*
- mruby-io: mrb_io_hal_* -> mrb_hal_io_*
- mruby-socket: mrb_socket_hal_* -> mrb_hal_socket_*
- mruby-dir: mrb_dir_hal_* -> mrb_hal_dir_*

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-16 09:59:03 +09:00
Yukihiro "Matz" Matsumoto 87c8889726 mruby-task: move platform-specific sleep to hal
task.c used clock_gettime() directly, breaking portability. added
mrb_task_hal_sleep_us() to hal interface.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-15 08:00:34 +09:00
Yukihiro "Matz" Matsumoto 4fa51c8ea0 task_hal.h: remove non-HAL function declarations
removes mrb_tasks_run and mrb_task_mark_all from task_hal.h as these
are core scheduler functions, not HAL interface functions. only
mrb_tick remains as it must be called by HAL timer callbacks.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-14 23:10:34 +09:00
Yukihiro "Matz" Matsumoto 9c100ab844 mruby-task: introduce HAL (hardware abstraction layer) for platform support
separates platform-specific timer and interrupt code into hal-posix-task
and hal-win-task gems. mruby-task now uses HAL interface defined in
task_hal.h, making it easier to port to new platforms.

hal-posix-task: uses sigalrm/setitimer for timer, sigprocmask for irq
protection, and SA_RESTART flag to prevent EINTR on system calls.

hal-win-task: uses multimedia timer API and critical_section for irq
protection.

both HALs support multiple mrb_state instances with single shared timer.
auto-detection loads appropriate HAL based on platform.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-14 09:14:59 +09:00