Skip to content

Amp fixes#1

Merged
lhoward merged 4 commits intomainfrom
amp-fixes
Mar 22, 2026
Merged

Amp fixes#1
lhoward merged 4 commits intomainfrom
amp-fixes

Conversation

@lhoward
Copy link
Contributor

@lhoward lhoward commented Mar 22, 2026

No description provided.

lhoward and others added 4 commits March 20, 2026 10:42
- Save timer type in swifthal_timer_start so oneshot cancellation works
- Call dispatch_resume in swifthal_timer_start so the timer actually fires
- Resume the source in swifthal_timer_close before releasing to avoid
  crashing when releasing a suspended dispatch source

Amp-Thread-ID: https://ampcode.com/threads/T-019d0869-5a22-779b-b3d6-76212f36411e
Co-authored-by: Amp <amp@ampcode.com>
fwrite(buf, size, 1) and fread(buf, size, 1) return 1 on success
rather than the actual byte count, and partial reads are silently
lost. Swap to fwrite(buf, 1, size) and fread(buf, 1, size) so the
return value reflects the actual number of bytes transferred.

Amp-Thread-ID: https://ampcode.com/threads/T-019d0869-5a22-779b-b3d6-76212f36411e
Co-authored-by: Amp <amp@ampcode.com>
- Create threads detached so resources are reclaimed on exit
- swifthal_timeout_to_timespec now computes an absolute CLOCK_REALTIME
  deadline as required by mq_timedsend, mq_timedreceive, sem_timedwait,
  and pthread_mutex_timedlock (previously used a relative time which
  caused all timed waits to expire immediately)
- swifthal_os_sem_reset: handle EAGAIN from sem_trywait gracefully
  instead of treating a concurrent race as a fatal error

Amp-Thread-ID: https://ampcode.com/threads/T-019d0869-5a22-779b-b3d6-76212f36411e
Co-authored-by: Amp <amp@ampcode.com>
- swifthal_hwcycle_get on x86: return only the low 32 bits (a) instead
  of constructing a 64-bit value that gets silently truncated
- swifthal_hwcycle_to_ns: use clock_getres(CLOCK_MONOTONIC) to compute
  a meaningful cycle-to-nanosecond conversion instead of returning the
  unrelated sysconf(_SC_CLK_TCK) value

Amp-Thread-ID: https://ampcode.com/threads/T-019d0869-5a22-779b-b3d6-76212f36411e
Co-authored-by: Amp <amp@ampcode.com>
@lhoward lhoward merged commit 1d223fa into main Mar 22, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant