Граф коммитов

10 Коммитов

Автор SHA1 Сообщение Дата
卜部昌平 bb5a538207 use of stdckdint.h
C23 is going to have this header.  The industry is already moving
towards accepting it; OSes and compilers started to implement theirs.

Why not detect its presence and if any, prefer over other ways.

See also:

- https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2683.pdf
- https://reviews.freebsd.org/D41734
- https://reviews.llvm.org/D157331
- https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8441841a1b985d68245954af1ff023db121b0635
2024-04-27 21:55:28 +09:00
Yusuke Endoh b51b22513f
Fix per-instance Regexp timeout (#6621)
Fix per-instance Regexp timeout

This makes it follow what was decided in [Bug #19055]:

* `Regexp.new(str, timeout: nil)` should respect the global timeout
* `Regexp.new(str, timeout: huge_val)` should use the maximum value that
  can be represented in the internal representation
* `Regexp.new(str, timeout: 0 or negative value)` should raise an error
2022-10-24 18:03:26 +09:00
Jean Boussier e3aabe93aa Implement Queue#pop(timeout: sec)
[Feature #18774]

As well as `SizedQueue#pop(timeout: sec)`

If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
2022-08-02 11:04:28 +02:00
Yusuke Endoh a94002115b thread.c: Move double2hrtime and hrtime2double to hrtime.h
... to make them available in other places than thread.c
2022-03-30 16:50:46 +09:00
normal 3bcb4ff810 hrtime.h: fix typo in non-builtin overflow check
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-30 03:24:55 +00:00
normal 3a83ba90c3 hrtime.h: add note explaining current use of uint64_t [ci skip]
[ruby-core:88678]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 08:48:49 +00:00
nobu 50840311de hrtime.h: missing paren
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:49:41 +00:00
nobu 995bc9233f hrtime.h: explicit casts to time_t
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:48:41 +00:00
normal 95abea43fe hrtime.h: add documentation
I updated the patch with documentation but forgot about it,
earlier :x

[ruby-core:88616] [Misc #15014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 09:02:50 +00:00
normal b0253a7569 thread.c: use rb_hrtime_t scalar for high-resolution time operations
Relying on "struct timespec" was too annoying API-wise and
used more stack space.  "double" was a bit wacky w.r.t rounding
in the past, so now we'll switch to using a 64-bit type.

Unsigned 64-bit integer is able to give us over nearly 585
years of range with nanoseconds.  This range is good enough
for the Linux kernel internal time representation, so it
ought to be good enough for us.

This reduces the stack usage of functions while GVL is held
(and thus subject to marking) on x86-64 Linux (with ppoll):

	rb_wait_for_single_fd    120 => 104
	do_select                120 => 88

[ruby-core:88582] [Misc #15014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 06:58:35 +00:00