39 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 8956c5abb5 mruby.h: include mruby/presym.h for all source files
Since presym is now mandatory, mruby.h includes presym.h so that
MRB_SYM() macros are available everywhere without explicit include.
Remove redundant #include <mruby/presym.h> from all source files.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 16:50:58 +09:00
Yukihiro "Matz" Matsumoto 53a25bab14 mruby-sleep, hal-posix-socket: fix amalgamation compatibility
mruby-sleep: declare slp_tm before #ifdef _WIN32 block to fix
undeclared variable error in non-Windows branch.

hal-posix-socket: use #if defined(HAVE_SA_LEN) && HAVE_SA_LEN instead
of #ifdef HAVE_SA_LEN, since mruby-socket defines HAVE_SA_LEN to 0 on
non-BSD platforms.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-02 18:28:31 +09:00
Yukihiro "Matz" Matsumoto 5d62acc3b8 mruby-sleep: combine variable declaration with initialization 2025-10-26 20:01:30 +09:00
Yukihiro "Matz" Matsumoto b416d29010 mruby-sleep,mruby-task: define sleep methods as module functions
change sleep, usleep, sleep_ms from private methods to module functions
to match cruby behavior where sleep can be called as both bare sleep and
kernel.sleep.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-08 23:55:22 +09:00
Yukihiro "Matz" Matsumoto 8b39a57be7 mruby-sleep: add comprehensive call-seq documentation for sleep functionality
Added complete call-seq documentation for thread suspension methods in
src/sleep.c:

## Core Methods:

### sleep:
- Suspends current thread for specified duration in seconds
- Supports floating point precision when MRB_NO_FLOAT is not defined
- Returns actual number of seconds slept (rounded)
- Cross-platform implementation (Windows Sleep vs Unix nanosleep)
- Comprehensive examples showing fractional second delays

### usleep:
- Suspends current thread for specified duration in microseconds
- Provides microsecond-level precision for short delays
- Integer-only parameter for precise timing control
- Returns 0 on successful completion
- Examples demonstrating millisecond and microsecond delays

Co-authored-by: Atlassian Rovo Dev
2025-08-14 10:52:47 +09:00
Yukihiro "Matz" Matsumoto cc54865873 mruby-sleep: make #sleep (and #usleep) private 2025-03-07 17:17:43 +09:00
Yukihiro "Matz" Matsumoto bf8e19f7da mruby-sleep: use presym for initialization 2024-06-14 00:30:32 +09:00
Yukihiro "Matz" Matsumoto 19d9f48f7d mruby-sleep: update MIT license URL 2024-05-09 17:08:27 +09:00
Yukihiro "Matz" Matsumoto 87b358a342 Including header files in include/* by <> 2024-03-26 13:59:59 +09:00
Yukihiro "Matz" Matsumoto c32f7915fb reformat else clause indentation style 2023-05-20 00:21:01 +09:00
Yukihiro "Matz" Matsumoto 62e8f047b9 mruby-sleep/sleep.c: remove mrb_ prefix from static functions 2023-04-24 12:19:12 +09:00
John Bampton 696226a60e docs: standardize Markdown lists
Previously for lists we were using both `*` and `-` to start the list items.

This pr changes all lists to use `-`.
2022-10-26 13:09:41 +10:00
Yukihiro "Matz" Matsumoto 50f357ee5d mruby-sleep: make error messages consistent. 2022-03-09 15:21:14 +09:00
dearblue eca990b2ec Update gem spec for mruby-sleep
To align the spec like any other core mrbgems:
- Delete `spec.version`
- Set `spec.summary`
2021-05-03 23:17:04 +09:00
John Bampton 9d32d440eb feat(CI): add the GitHub Super Linter
The GitHub Super Linter is a more robust and better supported
tool than the current GitHub Actions we are using.

Running these checks:

ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true

https://github.com/marketplace/actions/super-linter
https://github.com/github/super-linter

Added the GitHub Super Linter badge to the README.

Also updated the pre-commit framework and added
more documentation on pre-commit.

Added one more pre-commit check: check-executables-have-shebangs

Added one extra check for merge conflicts to our
GitHub Actions.

EditorConfig and Markdown linting.

Minor grammar and spelling fixes.

Update linter.yml
2021-04-16 16:37:52 +09:00
John Bampton 3c1ce680a3 chore: fix grammar 2021-03-09 04:35:03 +10:00
John Bampton 1c9b1bfeb7 feat: add pre-commit framework 2021-03-01 10:06:17 +10:00
Yukihiro "Matz" Matsumoto 793fbab7d5 Rename mrb_sleep.c to sleep.c in mruby-sleep gem. 2021-02-12 11:11:10 +09:00
John Bampton 97eed4493f feat(CI): add a GitHub Action to lint the Markdown
Run on pull request only
Using https://www.npmjs.com/package/markdownlint-cli
Lint Markdown for rules:
- MD009/no-trailing-spaces
- MD012/no-multiple-blanks
- MD022/blanks-around-headings
- MD031/blanks-around-fences
- MD032/blanks-around-lists
2020-12-19 18:22:08 +10:00
John Bampton 6f6149509a 🔒 Fix missing HTTPS on links 2020-12-19 17:52:16 +10:00
Yukihiro "Matz" Matsumoto 33742d941f Move build_config.rb -> build_config/default.rb; ref #5098
In addition, update the documents referring `build_config.rb` which is
no longer used. The new `build_config.rb` describes the new configuration
structure in the comment.
2020-10-29 11:49:05 +09:00
Yukihiro "Matz" Matsumoto 8a87549315 Rename float configuration option names.
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT`
- `MRB_USE_FLOAT` => `MRB_USE_FLOAT32`

The former is to use `USE_XXX` naming convention. The latter is to make
sure `float` is 32bit float and not floating point number in general.
2020-10-12 16:21:40 +09:00
Yukihiro "Matz" Matsumoto 5210482c59 Add cast for mrb_fixnum_value() from time_t. 2020-08-11 16:01:23 +09:00
Yukihiro "Matz" Matsumoto 5e55b61c44 Fix mrb_int and size_t combination warnings. 2020-08-11 15:06:51 +09:00
Yukihiro "Matz" Matsumoto 106f4c4e9d Add proper casts to silence VC warnings. 2020-06-05 16:04:30 +09:00
dearblue 56de911b7a Add "mruby developers" into some gems; Resolve #4709
It is writing side by side with the original authors.
2019-12-09 23:49:03 +09:00
Yukihiro "Matz" Matsumoto 9383e9d469 Removed unnecessary files from mruby-sleep; #4702 2019-09-12 06:54:09 +09:00
Yukihiro "Matz" Matsumoto 13c3802073 Remove Rakefile from mruby-sleep gem; fix #4702
The `Rakefile` was a leftover from the time it was an independent gem.
2019-09-11 20:28:52 +09:00
KOBAYASHI Shuji 1cd57006f3 Refine error message for time interval
Time interval value can be zero, and float (in `Kernel#sleep`)
2019-01-26 18:37:53 +09:00
KOBAYASHI Shuji 3707ef3d1c Use assert_raise and assert_nothing_raised in mruby-sleep tests 2019-01-21 19:37:20 +09:00
icm7216 59651f43ad Specify the core library instead of the external library. 2018-12-12 00:54:15 +09:00
icm7216 74c5402211 Sleep module is undefined. Remove module name. 2018-12-12 00:52:07 +09:00
Yukihiro "Matz" Matsumoto 7ad53273a2 Silence Appveyor's VC compilation warnings. 2018-11-01 22:52:12 +09:00
take-cheeze 1b185f08e7 Suppress sleep test script warning 2018-10-29 13:58:25 +09:00
Yukihiro "Matz" Matsumoto 87ce740168 Disambiguate block braces. 2018-09-26 12:17:38 +09:00
Yukihiro "Matz" Matsumoto fdaec90780 Make Kernel#sleep to accept float as a duration time.
But when `MRB_WITHOUT_FLOAT` is set, there's no way to sleep for
sub seconds. So mruby specific `usleep` is provided.
2018-09-06 23:42:05 +09:00
Yukihiro "Matz" Matsumoto 72522f8e0e Remove Sleep module that does not exist in CRuby. 2018-09-06 23:35:32 +09:00
Yukihiro "Matz" Matsumoto a170c1dd70 Refactored mruby-sleep gem.
* Method implementation functions made `static`.
 * Function declaration style has been changed.
 * Unnecessary header file `mrb_sleep.h` removed.
 * Used `mrb_get_args()` instead of self parsing.
 * Indentation kept untouched.
2018-09-05 14:55:49 +09:00
Yukihiro "Matz" Matsumoto 44fdd53f2e Add mruby-sleep gem to the core. 2018-09-05 13:30:14 +09:00