Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
33b5c4a
[wasm] Bump emscripten to 3.1.34
radekdoulik Mar 27, 2023
dff44d4
Update emsdk deps
radekdoulik Mar 27, 2023
ce1a265
Update icu deps
radekdoulik Mar 27, 2023
ed96a04
Use new images
radekdoulik Mar 27, 2023
8e6a28c
Use emscripten_main_runtime_thread_id
radekdoulik Mar 27, 2023
81672f4
Ignore ExitStatus exceptions
radekdoulik Mar 28, 2023
c2cbb94
Handle UnhandledPromiseRejection for ExitStatus
radekdoulik Mar 28, 2023
f3edd6e
Merge branch 'main' into pr-wasm-emscripten-3-1-34
radekdoulik Mar 28, 2023
4c0cb9e
[wasm][threads] flip YieldFromDispatchLoop; specialize PortableThread…
lambdageek Mar 15, 2023
3d88608
[mono] Implement a LifoJSSemaphore
lambdageek Mar 20, 2023
55b4649
Make managed LowLevelJSSemaphore
lambdageek Mar 20, 2023
8c74dea
copy-paste PortableThreadPool.WorkerThread for threaded WASM
lambdageek Mar 20, 2023
b323f0e
fixup native code for lifo semaphore
lambdageek Mar 21, 2023
51b1fbf
fixup managed code for LowLevelJSSemaphore
lambdageek Mar 21, 2023
3727ff1
Implement PortableThreadPool loop using semaphore callbacks
lambdageek Mar 21, 2023
763edab
manage emscripten event loop from PortableThreadPool.WorkerThread
lambdageek Mar 22, 2023
b45d001
FIXME: thread equality assertion in timeout callback
lambdageek Mar 22, 2023
1f7620c
XXX REVERT ME - minimal async timeout test
lambdageek Mar 22, 2023
06a3cc1
BUGFIX: &wait_entry ===> wait_entry
lambdageek Mar 23, 2023
8574368
nit: log thread id as hex in .ts
lambdageek Mar 23, 2023
c86cb26
XXX minimal sample - fetch on a background thread works
lambdageek Mar 23, 2023
c3cad74
fix non-wasm non-threads builds
lambdageek Mar 24, 2023
e57b262
Add WebWorkerEventLoop internal class to managed event loop keepalive
lambdageek Mar 24, 2023
07eabcd
Start threadpool threads with keepalive checks
lambdageek Mar 24, 2023
474607e
HACK: kind of work around the emscripten_runtime_keepalive_push/pop n…
lambdageek Mar 24, 2023
9f45167
support JS Semaphore with --print-icall-table cross compiler
lambdageek Mar 27, 2023
2e1f31f
make minimal FetchBackground sample more like a unit test
lambdageek Mar 27, 2023
dacc0cb
Share PortableThreadPool.WorkerThread common code
lambdageek Mar 29, 2023
10ca330
make both kinds of lifo semaphore share a base struct
lambdageek Mar 30, 2023
f4a2c02
Unify LowLevelLifoSemaphore for normal and async waiting
lambdageek Mar 30, 2023
42388d8
WebWorkerEventLoop: remove dead code, update comments
lambdageek Mar 31, 2023
853938e
remove unused arg from async wait semaphore
lambdageek Mar 31, 2023
cb8b168
rename native semaphore to LifoSemaphoreAsyncWait
lambdageek Mar 31, 2023
3e8fee4
Rename managed file to LowLevelLifoSemaphore.AsyncWait.Browser.Thread…
lambdageek Mar 31, 2023
552f9a5
Remove unnecessary indirections and allocations from managed AsyncWai…
lambdageek Mar 31, 2023
812524f
fix non-browser+threads builds
lambdageek Mar 31, 2023
50c0f1a
Keep track of unsettled JS interop promises in threadpool workers
lambdageek Apr 3, 2023
c8afaba
change minimal sample's fetch helper to artificially delay
lambdageek Apr 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix non-browser+threads builds
  • Loading branch information
lambdageek committed Mar 31, 2023
commit 812524fd2614cc8e70d5f2f6a082f6b4456feb9e
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ private LowLevelLifoSemaphore(int initialSignalCount, int maximumSignalCount, in
#pragma warning disable IDE0060
private void CreateAsyncWait(int maximumSignalCount)
{
_kind = LifoSemaphoreKind.AsyncWait;
lifo_semaphore = InitInternal((int)_kind);
Kind = LifoSemaphoreKind.AsyncWait;
lifo_semaphore = InitInternal((int)Kind);
}
#pragma warning restore IDE0060

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,46 @@ namespace System.Threading
internal sealed unsafe partial class LowLevelLifoSemaphore : IDisposable
{
private IntPtr lifo_semaphore;
#if FEATURE_WASM_THREADS
#if TARGET_BROWSER && FEATURE_WASM_THREADS
private LifoSemaphoreKind _kind;
#endif

#pragma warning disable CA1822
private LifoSemaphoreKind Kind
#pragma warning restore CA1822
{
get
{
#if TARGET_BROWSER && FEATURE_WASM_THREADS
return _kind;
#else
return LifoSemaphoreKind.Normal;
#endif
}
set
{
#if TARGET_BROWSER && FEATURE_WASM_THREADS
_kind = value;
#endif
}
}

// Keep in sync with lifo-semaphore.h
private enum LifoSemaphoreKind : int {
Normal = 1,
#if TARGET_BROWSER && FEATURE_WASM_THREADS
AsyncWait = 2,
}
#endif
}

[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern IntPtr InitInternal(int kind);

#pragma warning disable IDE0060
private void Create(int maximumSignalCount)
{
_kind = LifoSemaphoreKind.Normal;
lifo_semaphore = InitInternal((int)_kind);
Kind = LifoSemaphoreKind.Normal;
lifo_semaphore = InitInternal((int)Kind);
}
#pragma warning restore IDE0060

Expand All @@ -36,7 +58,7 @@ public void Dispose()
{
DeleteInternal(lifo_semaphore);
lifo_semaphore = IntPtr.Zero;
_kind = (LifoSemaphoreKind)0;
Kind = (LifoSemaphoreKind)0;
}

[MethodImplAttribute(MethodImplOptions.InternalCall)]
Expand All @@ -48,10 +70,14 @@ private bool WaitCore(int timeoutMs)
return TimedWaitInternal(lifo_semaphore, timeoutMs) != 0;
}

#pragma warning disable CA1822
private void ThrowIfInvalidSemaphoreKind(LifoSemaphoreKind expected)
#pragma warning restore CA1822
{
#if TARGET_BROWSER && FEATURE_WASM_THREADS
if (_kind != expected)
throw new InvalidOperationException ($"Unexpected LowLevelLifoSemaphore kind {_kind} expected {expected}");
#endif
}

[MethodImplAttribute(MethodImplOptions.InternalCall)]
Expand Down