Loop now uses the clock's deadline method

This commit is contained in:
Mattia Giambirtone 2023-06-01 20:02:07 +02:00
parent bfa69a6db2
commit bc60572c31
Signed by: nocturn9x
GPG Key ID: 8270F9F467971E59
4 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.11 (StructuredIO)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (StructuredIO)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (StructuredIO)" project-jdk-type="Python SDK" />
</project>

View File

@ -189,7 +189,7 @@ class FIFOKernel(BaseKernel):
self.suspend()
if amount > 0:
self.event("before_sleep", self.current_task, amount)
self.current_task.next_deadline = self.current_task.paused_when + amount
self.current_task.next_deadline = self.clock.deadline(amount)
self.paused.put(self.current_task, amount)
else:
# If sleep is called with 0 as argument,

View File

@ -34,6 +34,7 @@ async def main_3(data: bytes):
assert not await path.exists()
await aprint(f"[main] Done in {structio.clock() - t:.2f} seconds")
MB = 1048576
payload = b"a" * MB * 100
# Write 100MiB of data (too much?)