Skip to content

Commit

Permalink
[release/7.0-staging] [browser] fix job queue timespan calculation (#…
Browse files Browse the repository at this point in the history
…85784)

Co-authored-by: pavelsavara <pavel.savara@gmail.com>
Co-authored-by: Ilona Tomkowicz <itomkowicz@microsoft.com>
  • Loading branch information
3 people committed May 12, 2023
1 parent bf47f0d commit 2b28c92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private bool SetTimer(uint actualDuration)
// shortest time of all TimerQueues
private static void ReplaceNextSetTimeout(long shortestDueTimeMs, long currentTimeMs)
{
if (shortestDueTimeMs == int.MaxValue)
if (shortestDueTimeMs == long.MaxValue)
{
return;
}
Expand All @@ -85,7 +85,7 @@ private static long ShortestDueTime()
{
if (s_scheduledTimers == null)
{
return int.MaxValue;
return long.MaxValue;
}

long shortestDueTimeMs = long.MaxValue;
Expand All @@ -112,7 +112,7 @@ private static long PumpTimerQueue(long currentTimeMs)
List<TimerQueue> timersToFire = s_scheduledTimersToFire!;
List<TimerQueue> timers;
timers = s_scheduledTimers!;
long shortestDueTimeMs = int.MaxValue;
long shortestDueTimeMs = long.MaxValue;
for (int i = timers.Count - 1; i >= 0; --i)
{
TimerQueue timer = timers[i];
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/utils/mono-os-mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#if !defined(HOST_WIN32)

#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_WASM)
#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_WASI)
#define BROKEN_CLOCK_SOURCE
#endif

Expand Down
5 changes: 3 additions & 2 deletions src/mono/mono/utils/mono-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ gint64
mono_msec_boottime (void)
{
/* clock_gettime () is found by configure on Apple builds, but its only present from ios 10, macos 10.12, tvos 10 and watchos 3 */
#if !defined (TARGET_WASM) && ((defined(HAVE_CLOCK_MONOTONIC_COARSE) || defined(HAVE_CLOCK_MONOTONIC)) && !(defined(TARGET_IOS) || defined(TARGET_OSX) || defined(TARGET_WATCHOS) || defined(TARGET_TVOS)))
#if ((defined(HAVE_CLOCK_MONOTONIC_COARSE) || defined(HAVE_CLOCK_MONOTONIC)) && !(defined(TARGET_IOS) || defined(TARGET_OSX) || defined(TARGET_WATCHOS) || defined(TARGET_TVOS)))
clockid_t clockType =
#if HAVE_CLOCK_MONOTONIC_COARSE
/* emscripten exposes CLOCK_MONOTONIC_COARSE but doesn't implement it */
#if defined(HAVE_CLOCK_MONOTONIC_COARSE) && !defined(TARGET_WASM)
CLOCK_MONOTONIC_COARSE; /* good enough resolution, fastest speed */
#else
CLOCK_MONOTONIC;
Expand Down

0 comments on commit 2b28c92

Please sign in to comment.