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

1769 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 606e785fa8
Reuse ractor stderr 2021-10-07 19:57:09 +09:00
Nobuyoshi Nakada a706c09fa6
Adjust styles [ci skip] 2021-10-07 19:57:09 +09:00
S.H dc9112cf10
Using NIL_P macro instead of `== Qnil` 2021-10-03 22:34:45 +09:00
Kazuhiro NISHIYAMA e0c6e8c64a
[DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip] 2021-09-23 09:20:00 +09:00
S-H-GAMELINKS 032534dbdf Using RB_BIGNUM_TYPE_P macro 2021-09-11 09:13:24 +09:00
Lars Kanis 6594623f62 Fix Marshal.dump(closed_io) to raise TypeError and allow encoding on closed IO
Mashalling a closed IO object raised "closed stream (IOError)" before instead of TypeError.
This changes IO#(in|ex)ternal_encoding to still return the encoding even if the underlying FD is closed.

Fixes bug #18077
2021-08-22 10:33:22 +09:00
Nobuyoshi Nakada a8714b83c4
`popen()` is not available on emscripten 2021-08-16 17:00:19 +09:00
Csaba Henk 8df1ace64a Fix ARGF.read(length) short read [Bug #18074] 2021-08-10 11:32:45 +09:00
Samuel Williams 3a8cadcf8f Reduce chance to receive EBADF when closing an IO from another thread. 2021-08-08 22:12:14 +12:00
S.H 378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Nobuyoshi Nakada 3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Yusuke Endoh eee709595c io.c: Clarify the behavior of `IO.read` when called as `File.read`
Ditto to `IO.binread`, `IO.write`, `IO.binwrite`, `IO.foreach`, and
`IO.readlines`.
2021-07-16 16:10:54 +09:00
Yusuke Endoh 645616c273 process.c: Call rb_thread_atfork in rb_fork_ruby
All occurrences of rb_fork_ruby are followed by a call rb_thread_fork in
the created child process.

This is refactoring and a potential preparation for [Feature #17795].
(rb_fork_ruby may be wrapped by Process._fork_.)
2021-07-15 16:46:08 +09:00
Nobuyoshi Nakada 59ead88563
[DOC] add notes and examples for pipe [ci skip] 2021-06-30 15:45:21 +09:00
Nobuyoshi Nakada 13939d61b4
Check if closed after each yield [Bug #17661] 2021-06-27 11:18:41 +09:00
Nobuyoshi Nakada 6875408583
Introduced RUBY_CRLF_ENVIRONMENT to simplify repeated condition 2021-06-24 13:01:46 +09:00
Samuel Williams fcc6fd23ec Rework `sysread` to use blocking `read_internal_locktmp`. 2021-06-22 22:48:57 +12:00
Samuel Williams 45e65f302b Deprecate and rework old (fd) centric functions. 2021-06-22 22:48:57 +12:00
Samuel Williams 3deb5d7113 Direct io for accept, send, sendmsg, recvfrom, and related methods. 2021-06-22 22:17:53 +12:00
Burdette Lamar c1741df1a1 What's Here for Numeric and Comparable 2021-06-21 10:38:16 -07:00
Nobuyoshi Nakada e4f891ce8d
Adjust styles [ci skip]
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
Nobuyoshi Nakada f136c1ec80
Removed redundant NUM2IOCTLREQ definition [Bug #17759]
Fix up c2d9967f78.
2021-06-16 13:33:56 +09:00
Nobuyoshi Nakada c2d9967f78 Configure ioctl request argument type [Bug #17759] 2021-06-16 13:17:19 +09:00
Kazuhiro NISHIYAMA 8560f34246
Fix a typo [ci skip] 2021-05-16 00:07:22 +09:00
Nobuyoshi Nakada 2d67027448 Removed missing/dup2.c
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9.  Also the code in this
file is MT-unsafe.
2021-05-10 15:59:23 +09:00
Burdette Lamar fd3a20348e
What's Here for class IO (#4440)
* What's Here for class IO
2021-05-04 13:59:33 -05:00
Jeremy Evans c809a8cae8 Fix documentation for IO#unget{byte,c}
Fixes [Bug #14400]
2021-05-04 11:23:57 -07:00
Kenichi Kamiya 52fb0a2932 [Doc] Drop signature around removed IO#codepoints
Follow 43b95bafd5
2021-04-05 11:47:42 +09:00
Samuel Williams a9c5c2d614 Check errno before invoking scheduler in `rb_io_wait_readable/writable`.
See <https://bugs.ruby-lang.org/issues/17527> for more details.
2021-03-30 23:16:59 +13:00
S.H 71ba09632b
Remove unneeded declarations 2021-03-20 21:00:29 +09:00
Samuel Williams 5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
Nobuyoshi Nakada bf627e518d
Forward keyword arguments to ARGF from global functions 2021-02-08 11:33:53 +09:00
Yusuke Endoh 33fb87cc9c io.c: popen is not available on emscripten 2021-01-23 13:24:06 +09:00
Marcus Stollsteimer 3108ad7bf3 [DOC] Fix grammar: "is same as" -> "is the same as" 2021-01-05 15:13:53 +01:00
Nobuyoshi Nakada ae1cc3fd4e
Made an internal callback function static 2020-12-20 14:29:31 +09:00
Jeremy Evans 05313c914b Use category: :deprecated in warnings that are related to deprecation
Also document that both :deprecated and :experimental are supported
:category option values.

The locations where warnings were marked as deprecation warnings
was previously reviewed by shyouhei.

Comment a couple locations where deprecation warnings should probably
be used but are not currently used because deprecation warning
enablement has not occurred at the time they are called
(RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K).

Add assert_deprecated_warn to test assertions.  Use this to simplify
some tests, and fix failing tests after marking some warnings with
deprecated category.
2020-12-18 09:54:11 -08:00
Nobuyoshi Nakada b419f90a8b
Tweaked `Process::Status.wait`
* revert `rb_last_status_set`
* renamed the new function as `rb_process_status_new`
* `rb_process_status_new` always freezes the return value
* marked `Process::Status.wait` as EXPERIMENTAL, as it has not
  been discussed totally yet.
2020-12-09 11:51:57 +09:00
Samuel Williams 2553c5f94a Add support for non-blocking `Process.wait`. 2020-12-09 08:55:35 +13:00
卜部昌平 43b95bafd5
delete deprecated IO-like methods
This commit deletes
{IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which
have been deprecated since c47c095b97.

Note that String also has those methods.  They are neither depreacted
nor deleted because they are not aliases of counterpart each_something.
2020-12-03 12:47:51 +09:00
Koichi Sasada 5e3259ea74 fix public interface
To make some kind of Ractor related extensions, some functions
should be exposed.

* include/ruby/thread_native.h
  * rb_native_mutex_*
  * rb_native_cond_*
* include/ruby/ractor.h
  * RB_OBJ_SHAREABLE_P(obj)
  * rb_ractor_shareable_p(obj)
  * rb_ractor_std*()
  * rb_cRactor

and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
    (to avoid conflict with include/ruby/ractor.h)
2020-11-18 03:52:41 +09:00
Samuel Williams a08ee8330d Rename to `Fiber#set_scheduler`. 2020-11-07 23:39:50 +13:00
Jeremy Evans 58fd54f914 Fix error in update-deps due to tab/space difference 2020-10-28 15:29:05 -07:00
Stefan Stüben 8c2e5bbf58 Don't redefine #rb_intern over and over again 2020-10-21 12:45:18 +09:00
Koichi Sasada 99310e3eb5 Some global variables can be accessed from ractors
Some global variables should be used from non-main Ractors.
[Bug #17268]

```ruby
     # ractor-local (derived from created ractor): debug
     '$DEBUG' => $DEBUG,
     '$-d' => $-d,

     # ractor-local (derived from created ractor): verbose
     '$VERBOSE' => $VERBOSE,
     '$-w' => $-w,
     '$-W' => $-W,
     '$-v' => $-v,

     # process-local (readonly): other commandline parameters
     '$-p' => $-p,
     '$-l' => $-l,
     '$-a' => $-a,

     # process-local (readonly): getpid
     '$$'  => $$,

     # thread local: process result
     '$?'  => $?,

     # scope local: match
     '$~'  => $~.inspect,
     '$&'  => $&,
     '$`'  => $`,
     '$\''  => $',
     '$+'  => $+,
     '$1'  => $1,

     # scope local: last line
     '$_' => $_,

     # scope local: last backtrace
     '$@' => $@,
     '$!' => $!,

     # ractor local: stdin, out, err
     '$stdin'  => $stdin.inspect,
     '$stdout' => $stdout.inspect,
     '$stderr' => $stderr.inspect,
```
2020-10-20 15:38:54 +09:00
Nobuyoshi Nakada fddffa4c7a
Respect the original styles [ci skip] 2020-10-11 11:57:32 +09:00
Samuel Williams f75009c122 Prefer to use `prep_io` for temporary IO instances. 2020-09-17 00:31:04 +12:00
Samuel Williams 026ba68c10 Fix handling of FMODE_PREP. 2020-09-15 22:53:08 +12:00
Samuel Williams a9b2a96c5c Fix incorrect initialization of `rb_io_t::self`. 2020-09-15 22:53:08 +12:00
Samuel Williams 9e0a48c7a3 Prefer `rb_thread_current_scheduler`. 2020-09-14 16:44:09 +12:00
Samuel Williams 701dcbb3ca Add support for hooking `IO#read`. 2020-09-14 16:44:09 +12:00