forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WASI] timers based on wasi:clocks (dotnet#105879)
- Loading branch information
1 parent
019d758
commit 7c0364e
Showing
19 changed files
with
474 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.WASI.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<linker> | ||
<assembly fullname="System.Private.CoreLib"> | ||
<!-- these methods are temporarily accessed via UnsafeAccessor from generated code until we have it in public API, probably in WASI preview3 and promises --> | ||
<type fullname="System.Threading.Thread"> | ||
<method name="RegisterWasiPollableHandle" /> | ||
<method name="PollWasiEventLoopUntilResolved" /> | ||
</type> | ||
</assembly> | ||
</linker> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...stem/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Generated by `wit-bindgen` 0.29.0. DO NOT EDIT! | ||
// <auto-generated /> | ||
#nullable enable | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Collections; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace WasiPollWorld.wit.imports.wasi.clocks.v0_2_1 | ||
{ | ||
internal static class MonotonicClockInterop { | ||
|
||
internal static class NowWasmInterop | ||
{ | ||
[DllImport("wasi:clocks/[email protected]", EntryPoint = "now"), WasmImportLinkage] | ||
internal static extern long wasmImportNow(); | ||
|
||
} | ||
|
||
internal static unsafe ulong Now() | ||
{ | ||
var result = NowWasmInterop.wasmImportNow(); | ||
return unchecked((ulong)(result)); | ||
|
||
//TODO: free alloc handle (interopString) if exists | ||
} | ||
|
||
internal static class ResolutionWasmInterop | ||
{ | ||
[DllImport("wasi:clocks/[email protected]", EntryPoint = "resolution"), WasmImportLinkage] | ||
internal static extern long wasmImportResolution(); | ||
|
||
} | ||
|
||
internal static unsafe ulong Resolution() | ||
{ | ||
var result = ResolutionWasmInterop.wasmImportResolution(); | ||
return unchecked((ulong)(result)); | ||
|
||
//TODO: free alloc handle (interopString) if exists | ||
} | ||
|
||
internal static class SubscribeInstantWasmInterop | ||
{ | ||
[DllImport("wasi:clocks/[email protected]", EntryPoint = "subscribe-instant"), WasmImportLinkage] | ||
internal static extern int wasmImportSubscribeInstant(long p0); | ||
|
||
} | ||
|
||
internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeInstant(ulong when) | ||
{ | ||
var result = SubscribeInstantWasmInterop.wasmImportSubscribeInstant(unchecked((long)(when))); | ||
var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); | ||
return resource; | ||
|
||
//TODO: free alloc handle (interopString) if exists | ||
} | ||
|
||
internal static class SubscribeDurationWasmInterop | ||
{ | ||
[DllImport("wasi:clocks/[email protected]", EntryPoint = "subscribe-duration"), WasmImportLinkage] | ||
internal static extern int wasmImportSubscribeDuration(long p0); | ||
|
||
} | ||
|
||
internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeDuration(ulong when) | ||
{ | ||
var result = SubscribeDurationWasmInterop.wasmImportSubscribeDuration(unchecked((long)(when))); | ||
var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); | ||
return resource; | ||
|
||
//TODO: free alloc handle (interopString) if exists | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ tar xzf v0.2.1.tar.gz | |
cat >wasi-http-0.2.1/wit/world.wit <<EOF | ||
world wasi-poll { | ||
import wasi:io/[email protected]; | ||
import wasi:clocks/[email protected]; | ||
} | ||
EOF | ||
wit-bindgen c-sharp -w wasi-poll -r native-aot --internal --skip-support-files wasi-http-0.2.1/wit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.