rloop 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rloop-0.1.3 → rloop-0.1.4}/Cargo.lock +28 -28
- {rloop-0.1.3 → rloop-0.1.4}/Cargo.toml +4 -4
- {rloop-0.1.3 → rloop-0.1.4}/PKG-INFO +1 -8
- {rloop-0.1.3 → rloop-0.1.4}/pyproject.toml +14 -6
- {rloop-0.1.3 → rloop-0.1.4}/rloop/__init__.py +1 -2
- rloop-0.1.4/rloop/_compat.py +11 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/loop.py +1 -1
- {rloop-0.1.3 → rloop-0.1.4}/src/event_loop.rs +46 -10
- {rloop-0.1.3 → rloop-0.1.4}/src/handles.rs +2 -2
- {rloop-0.1.3 → rloop-0.1.4}/src/io.rs +1 -1
- {rloop-0.1.3 → rloop-0.1.4}/src/lib.rs +1 -1
- {rloop-0.1.3 → rloop-0.1.4}/src/tcp.rs +2 -2
- rloop-0.1.4/src/utils.rs +12 -0
- rloop-0.1.3/rloop/_compat.py +0 -5
- rloop-0.1.3/src/utils.rs +0 -27
- {rloop-0.1.3 → rloop-0.1.4}/LICENSE +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/README.md +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/_rloop.pyi +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/exc.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/futures.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/server.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/subprocess.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/transports.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/rloop/utils.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/src/log.rs +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/src/py.rs +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/src/server.rs +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/src/sock.rs +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/src/time.rs +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/conftest.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/tcp/__init__.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/tcp/test_tcp_conn.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/tcp/test_tcp_server.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/test_handles.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/test_sockets.py +0 -0
- {rloop-0.1.3 → rloop-0.1.4}/tests/udp/test_udp.py +0 -0
|
@@ -10,15 +10,15 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
|
|
10
10
|
|
|
11
11
|
[[package]]
|
|
12
12
|
name = "autocfg"
|
|
13
|
-
version = "1.
|
|
13
|
+
version = "1.5.0"
|
|
14
14
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
-
checksum = "
|
|
15
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
16
16
|
|
|
17
17
|
[[package]]
|
|
18
18
|
name = "cc"
|
|
19
|
-
version = "1.2.
|
|
19
|
+
version = "1.2.29"
|
|
20
20
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
-
checksum = "
|
|
21
|
+
checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362"
|
|
22
22
|
dependencies = [
|
|
23
23
|
"shlex",
|
|
24
24
|
]
|
|
@@ -43,9 +43,9 @@ checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
|
|
43
43
|
|
|
44
44
|
[[package]]
|
|
45
45
|
name = "libc"
|
|
46
|
-
version = "0.2.
|
|
46
|
+
version = "0.2.174"
|
|
47
47
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
-
checksum = "
|
|
48
|
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
|
49
49
|
|
|
50
50
|
[[package]]
|
|
51
51
|
name = "log"
|
|
@@ -82,9 +82,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
|
82
82
|
|
|
83
83
|
[[package]]
|
|
84
84
|
name = "papaya"
|
|
85
|
-
version = "0.2.
|
|
85
|
+
version = "0.2.3"
|
|
86
86
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
87
|
-
checksum = "
|
|
87
|
+
checksum = "f92dd0b07c53a0a0c764db2ace8c541dc47320dad97c2200c2a637ab9dd2328f"
|
|
88
88
|
dependencies = [
|
|
89
89
|
"equivalent",
|
|
90
90
|
"seize",
|
|
@@ -92,9 +92,9 @@ dependencies = [
|
|
|
92
92
|
|
|
93
93
|
[[package]]
|
|
94
94
|
name = "portable-atomic"
|
|
95
|
-
version = "1.11.
|
|
95
|
+
version = "1.11.1"
|
|
96
96
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
-
checksum = "
|
|
97
|
+
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
|
98
98
|
|
|
99
99
|
[[package]]
|
|
100
100
|
name = "proc-macro2"
|
|
@@ -107,9 +107,9 @@ dependencies = [
|
|
|
107
107
|
|
|
108
108
|
[[package]]
|
|
109
109
|
name = "pyo3"
|
|
110
|
-
version = "0.25.
|
|
110
|
+
version = "0.25.1"
|
|
111
111
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
112
|
-
checksum = "
|
|
112
|
+
checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
|
|
113
113
|
dependencies = [
|
|
114
114
|
"anyhow",
|
|
115
115
|
"indoc",
|
|
@@ -125,9 +125,9 @@ dependencies = [
|
|
|
125
125
|
|
|
126
126
|
[[package]]
|
|
127
127
|
name = "pyo3-build-config"
|
|
128
|
-
version = "0.25.
|
|
128
|
+
version = "0.25.1"
|
|
129
129
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
130
|
-
checksum = "
|
|
130
|
+
checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
|
|
131
131
|
dependencies = [
|
|
132
132
|
"once_cell",
|
|
133
133
|
"python3-dll-a",
|
|
@@ -136,9 +136,9 @@ dependencies = [
|
|
|
136
136
|
|
|
137
137
|
[[package]]
|
|
138
138
|
name = "pyo3-ffi"
|
|
139
|
-
version = "0.25.
|
|
139
|
+
version = "0.25.1"
|
|
140
140
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
-
checksum = "
|
|
141
|
+
checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
|
|
142
142
|
dependencies = [
|
|
143
143
|
"libc",
|
|
144
144
|
"pyo3-build-config",
|
|
@@ -146,9 +146,9 @@ dependencies = [
|
|
|
146
146
|
|
|
147
147
|
[[package]]
|
|
148
148
|
name = "pyo3-macros"
|
|
149
|
-
version = "0.25.
|
|
149
|
+
version = "0.25.1"
|
|
150
150
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
151
|
-
checksum = "
|
|
151
|
+
checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
|
|
152
152
|
dependencies = [
|
|
153
153
|
"proc-macro2",
|
|
154
154
|
"pyo3-macros-backend",
|
|
@@ -158,9 +158,9 @@ dependencies = [
|
|
|
158
158
|
|
|
159
159
|
[[package]]
|
|
160
160
|
name = "pyo3-macros-backend"
|
|
161
|
-
version = "0.25.
|
|
161
|
+
version = "0.25.1"
|
|
162
162
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
-
checksum = "
|
|
163
|
+
checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
|
|
164
164
|
dependencies = [
|
|
165
165
|
"heck",
|
|
166
166
|
"proc-macro2",
|
|
@@ -189,7 +189,7 @@ dependencies = [
|
|
|
189
189
|
|
|
190
190
|
[[package]]
|
|
191
191
|
name = "rloop"
|
|
192
|
-
version = "0.1.
|
|
192
|
+
version = "0.1.4"
|
|
193
193
|
dependencies = [
|
|
194
194
|
"anyhow",
|
|
195
195
|
"libc",
|
|
@@ -218,19 +218,19 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
|
218
218
|
|
|
219
219
|
[[package]]
|
|
220
220
|
name = "socket2"
|
|
221
|
-
version = "0.
|
|
221
|
+
version = "0.6.0"
|
|
222
222
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
-
checksum = "
|
|
223
|
+
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
|
|
224
224
|
dependencies = [
|
|
225
225
|
"libc",
|
|
226
|
-
"windows-sys 0.
|
|
226
|
+
"windows-sys 0.59.0",
|
|
227
227
|
]
|
|
228
228
|
|
|
229
229
|
[[package]]
|
|
230
230
|
name = "syn"
|
|
231
|
-
version = "2.0.
|
|
231
|
+
version = "2.0.104"
|
|
232
232
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
-
checksum = "
|
|
233
|
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
|
234
234
|
dependencies = [
|
|
235
235
|
"proc-macro2",
|
|
236
236
|
"quote",
|
|
@@ -257,9 +257,9 @@ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
|
257
257
|
|
|
258
258
|
[[package]]
|
|
259
259
|
name = "wasi"
|
|
260
|
-
version = "0.11.
|
|
260
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
261
261
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
262
|
-
checksum = "
|
|
262
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
263
263
|
|
|
264
264
|
[[package]]
|
|
265
265
|
name = "windows-sys"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "rloop"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
description = "An asyncio event loop implemented in Rust"
|
|
5
5
|
authors = ["Giovanni Barillari <g@baro.dev>"]
|
|
6
6
|
license = "BSD-3-Clause"
|
|
7
|
-
edition = "
|
|
7
|
+
edition = "2024"
|
|
8
8
|
|
|
9
9
|
keywords = ["asyncio"]
|
|
10
10
|
|
|
@@ -27,14 +27,14 @@ include = [
|
|
|
27
27
|
|
|
28
28
|
[lib]
|
|
29
29
|
name = "_rloop"
|
|
30
|
-
crate-type = ["cdylib"]
|
|
30
|
+
crate-type = ["cdylib", "rlib"]
|
|
31
31
|
|
|
32
32
|
[dependencies]
|
|
33
33
|
anyhow = "=1.0"
|
|
34
34
|
mio = { version = "=1.0", features = ["net", "os-ext", "os-poll"] }
|
|
35
35
|
papaya = "=0.2"
|
|
36
36
|
pyo3 = { version = "=0.25", features = ["anyhow", "extension-module", "generate-import-lib"] }
|
|
37
|
-
socket2 = { version = "=0.
|
|
37
|
+
socket2 = { version = "=0.6", features = ["all"] }
|
|
38
38
|
|
|
39
39
|
[target.'cfg(unix)'.dependencies]
|
|
40
40
|
libc = "0.2.159"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rloop
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: BSD License
|
|
@@ -16,13 +16,6 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
16
16
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Rust
|
|
19
|
-
Requires-Dist: ruff~=0.5.0 ; extra == 'lint'
|
|
20
|
-
Requires-Dist: pytest~=7.4.2 ; extra == 'test'
|
|
21
|
-
Requires-Dist: pytest-asyncio~=0.21.1 ; extra == 'test'
|
|
22
|
-
Requires-Dist: rloop[lint,test] ; extra == 'dev'
|
|
23
|
-
Provides-Extra: lint
|
|
24
|
-
Provides-Extra: test
|
|
25
|
-
Provides-Extra: dev
|
|
26
19
|
License-File: LICENSE
|
|
27
20
|
Summary: An asyncio event loop implemented in Rust
|
|
28
21
|
Keywords: asyncio
|
|
@@ -32,15 +32,23 @@ dynamic = [
|
|
|
32
32
|
requires-python = '>=3.9'
|
|
33
33
|
dependencies = []
|
|
34
34
|
|
|
35
|
-
[
|
|
35
|
+
[dependency-groups]
|
|
36
|
+
build = [
|
|
37
|
+
'maturin~=1.8',
|
|
38
|
+
]
|
|
36
39
|
lint = [
|
|
37
|
-
'ruff~=0.
|
|
40
|
+
'ruff~=0.11',
|
|
38
41
|
]
|
|
39
42
|
test = [
|
|
40
|
-
'pytest~=
|
|
41
|
-
'pytest-asyncio~=0.
|
|
43
|
+
'pytest~=8.3',
|
|
44
|
+
'pytest-asyncio~=0.26',
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
all = [
|
|
48
|
+
{ include-group = 'build' },
|
|
49
|
+
{ include-group = 'lint' },
|
|
50
|
+
{ include-group = 'test' },
|
|
42
51
|
]
|
|
43
|
-
dev = ['rloop[lint,test]']
|
|
44
52
|
|
|
45
53
|
[project.urls]
|
|
46
54
|
Homepage = 'https://github.com/gi0baro/rloop'
|
|
@@ -48,7 +56,7 @@ Funding = 'https://github.com/sponsors/gi0baro'
|
|
|
48
56
|
Source = 'https://github.com/gi0baro/rloop'
|
|
49
57
|
|
|
50
58
|
[build-system]
|
|
51
|
-
requires = ['maturin>=1.
|
|
59
|
+
requires = ['maturin>=1.8.0,<2']
|
|
52
60
|
build-backend = 'maturin'
|
|
53
61
|
|
|
54
62
|
[tool.maturin]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
_PYV = int(sys.version_info.major * 100 + sys.version_info.minor)
|
|
5
|
+
_PY_311 = 311
|
|
6
|
+
_PY_314 = 314
|
|
7
|
+
|
|
8
|
+
if _PYV < 314:
|
|
9
|
+
from asyncio.events import BaseDefaultEventLoopPolicy as _BaseEventLoopPolicy
|
|
10
|
+
else:
|
|
11
|
+
from asyncio.events import _BaseDefaultEventLoopPolicy as _BaseEventLoopPolicy # noqa
|
|
@@ -391,7 +391,7 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
|
|
|
391
391
|
exceptions = [exc for sub in exceptions for exc in sub]
|
|
392
392
|
try:
|
|
393
393
|
if all_errors:
|
|
394
|
-
raise ExceptionGroup('create_connection failed', exceptions)
|
|
394
|
+
raise ExceptionGroup('create_connection failed', exceptions) # noqa: F821
|
|
395
395
|
if len(exceptions) == 1:
|
|
396
396
|
raise exceptions[0]
|
|
397
397
|
else:
|
|
@@ -3,23 +3,23 @@ use std::{
|
|
|
3
3
|
io::Read,
|
|
4
4
|
mem,
|
|
5
5
|
os::fd::{AsRawFd, FromRawFd},
|
|
6
|
-
sync::{
|
|
6
|
+
sync::{Mutex, RwLock, atomic},
|
|
7
7
|
time::{Duration, Instant},
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
use anyhow::Result;
|
|
11
|
-
use mio::{
|
|
11
|
+
use mio::{Interest, Poll, Token, event, net::TcpListener};
|
|
12
12
|
use pyo3::prelude::*;
|
|
13
13
|
|
|
14
14
|
use crate::{
|
|
15
15
|
handles::{BoxedHandle, CBHandle, Handle, TimerHandle},
|
|
16
16
|
io::Source,
|
|
17
|
-
log::{
|
|
17
|
+
log::{LogExc, log_exc_to_py_ctx},
|
|
18
18
|
py::{copy_context, weakset},
|
|
19
19
|
server::Server,
|
|
20
20
|
tcp::{TCPReadHandle, TCPServer, TCPServerRef, TCPTransport, TCPWriteHandle},
|
|
21
21
|
time::Timer,
|
|
22
|
-
utils::
|
|
22
|
+
utils::syscall,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const WAKEB: &[u8; 1] = b"\0";
|
|
@@ -43,7 +43,7 @@ struct TCPListenerHandleData {
|
|
|
43
43
|
server: TCPServerRef,
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
pub
|
|
46
|
+
pub struct EventLoopRunState {
|
|
47
47
|
buf: Box<[u8]>,
|
|
48
48
|
events: event::Events,
|
|
49
49
|
pub read_buf: Box<[u8]>,
|
|
@@ -164,7 +164,7 @@ impl EventLoop {
|
|
|
164
164
|
if idle_swap {
|
|
165
165
|
self.idle.store(true, atomic::Ordering::Release);
|
|
166
166
|
}
|
|
167
|
-
let res =
|
|
167
|
+
let res = py.allow_threads(|| {
|
|
168
168
|
let mut io = self.io.lock().unwrap();
|
|
169
169
|
let res = io.poll(&mut state.events, sched_time.map(Duration::from_micros));
|
|
170
170
|
if idle_swap {
|
|
@@ -631,6 +631,41 @@ impl EventLoop {
|
|
|
631
631
|
|
|
632
632
|
Ok(())
|
|
633
633
|
}
|
|
634
|
+
|
|
635
|
+
#[allow(clippy::missing_errors_doc)]
|
|
636
|
+
pub fn schedule_handle(&self, handle: impl Handle + Send + 'static, delay: Option<Duration>) -> Result<()> {
|
|
637
|
+
match delay {
|
|
638
|
+
Some(delay) => {
|
|
639
|
+
let when = (Instant::now().duration_since(self.epoch) + delay).as_micros();
|
|
640
|
+
let timer = Timer {
|
|
641
|
+
handle: Box::new(handle),
|
|
642
|
+
when,
|
|
643
|
+
};
|
|
644
|
+
{
|
|
645
|
+
let mut guard = self
|
|
646
|
+
.handles_sched
|
|
647
|
+
.lock()
|
|
648
|
+
.map_err(|_| anyhow::anyhow!("lock acquisition failed"))?;
|
|
649
|
+
guard.push(timer);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
None => {
|
|
653
|
+
{
|
|
654
|
+
let mut guard = self
|
|
655
|
+
.handles_ready
|
|
656
|
+
.lock()
|
|
657
|
+
.map_err(|_| anyhow::anyhow!("lock acquisition failed"))?;
|
|
658
|
+
guard.push_back(Box::new(handle));
|
|
659
|
+
}
|
|
660
|
+
self.counter_ready.fetch_add(1, atomic::Ordering::Release);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if self.idle.load(atomic::Ordering::Acquire) {
|
|
664
|
+
self.wake();
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
Ok(())
|
|
668
|
+
}
|
|
634
669
|
}
|
|
635
670
|
|
|
636
671
|
#[pymethods]
|
|
@@ -1167,10 +1202,11 @@ impl EventLoop {
|
|
|
1167
1202
|
break;
|
|
1168
1203
|
}
|
|
1169
1204
|
if let Err(err) = self.step(py, &mut state) {
|
|
1170
|
-
if err.kind() == std::io::ErrorKind::Interrupted
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1205
|
+
if err.kind() == std::io::ErrorKind::Interrupted {
|
|
1206
|
+
if self.sig_loop_handled.swap(false, atomic::Ordering::Relaxed) {
|
|
1207
|
+
continue;
|
|
1208
|
+
}
|
|
1209
|
+
break;
|
|
1174
1210
|
}
|
|
1175
1211
|
self.run_post(&mut state);
|
|
1176
1212
|
return Err(err.into());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use pyo3::{prelude
|
|
1
|
+
use pyo3::{IntoPyObjectExt, prelude::*};
|
|
2
2
|
use std::sync::atomic;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
@@ -10,7 +10,7 @@ use crate::{
|
|
|
10
10
|
#[cfg(not(PyPy))]
|
|
11
11
|
use crate::py::run_in_ctx1;
|
|
12
12
|
|
|
13
|
-
pub
|
|
13
|
+
pub trait Handle {
|
|
14
14
|
fn run(&self, py: Python, event_loop: &EventLoop, state: &mut EventLoopRunState);
|
|
15
15
|
fn cancelled(&self) -> bool {
|
|
16
16
|
false
|
|
@@ -5,7 +5,7 @@ use std::os::fd::RawFd;
|
|
|
5
5
|
#[cfg(windows)]
|
|
6
6
|
use std::os::windows::io::RawSocket;
|
|
7
7
|
|
|
8
|
-
use mio::{event::Source as MioSource, net::TcpListener
|
|
8
|
+
use mio::{Interest, Registry, Token, event::Source as MioSource, net::TcpListener};
|
|
9
9
|
|
|
10
10
|
pub(crate) enum Source {
|
|
11
11
|
TCPListener(TcpListener),
|
|
@@ -3,10 +3,10 @@ use std::os::fd::{AsRawFd, FromRawFd};
|
|
|
3
3
|
|
|
4
4
|
use anyhow::Result;
|
|
5
5
|
use mio::{
|
|
6
|
-
net::{TcpListener, TcpStream},
|
|
7
6
|
Interest,
|
|
7
|
+
net::{TcpListener, TcpStream},
|
|
8
8
|
};
|
|
9
|
-
use pyo3::{buffer::PyBuffer, prelude::*, types::PyBytes
|
|
9
|
+
use pyo3::{IntoPyObjectExt, buffer::PyBuffer, prelude::*, types::PyBytes};
|
|
10
10
|
use std::{
|
|
11
11
|
borrow::Cow,
|
|
12
12
|
cell::RefCell,
|
rloop-0.1.4/src/utils.rs
ADDED
rloop-0.1.3/rloop/_compat.py
DELETED
rloop-0.1.3/src/utils.rs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#[cfg(not(Py_GIL_DISABLED))]
|
|
2
|
-
macro_rules! py_allow_threads {
|
|
3
|
-
($py:expr, $func:tt) => {
|
|
4
|
-
$py.allow_threads(|| $func)
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#[cfg(Py_GIL_DISABLED)]
|
|
9
|
-
macro_rules! py_allow_threads {
|
|
10
|
-
($py:expr, $func:tt) => {
|
|
11
|
-
$func
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
macro_rules! syscall {
|
|
16
|
-
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
|
|
17
|
-
let res = unsafe { libc::$fn($($arg, )*) };
|
|
18
|
-
if res < 0 {
|
|
19
|
-
Err(std::io::Error::last_os_error())
|
|
20
|
-
} else {
|
|
21
|
-
Ok(res)
|
|
22
|
-
}
|
|
23
|
-
}};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
pub(super) use py_allow_threads;
|
|
27
|
-
pub(crate) use syscall;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|