Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Shouldn't this also be paired with a monotonic time opcode?

Đang mở
#230 9 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
wasm
Lĩnh vực
operating-systems

Hướng nghiên cứu

Bắt đầu với các wait opcodes hiện có trong Overview.md của đề xuất threads và xem xét các platform clock APIs được liệt kê ở đây. Xác định liệu có nên có một monotonic clock opcode bên cạnh chúng hay không, đồng thời ghi lại API được đề xuất và cách biểu diễn thời gian dự kiến. Được coi là hoàn tất khi đề xuất có một thiết kế đã được giải quyết thay vì một câu hỏi còn bỏ ngỏ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Sleep timers are normally batched for performance, with durations turned into deadlines, and effective batching requires tracking a monotonic clock to know precisely how long to wait for. In fact, processors normally mandate such batching at the operating system level. And this primitive is implemented on every platform, from embedded CPUs to high-performance operating systems, as it's a strict necessity.

Here's the API on various relevant platforms:

  • Operating systems:
    • Most Unix-like: clock_gettime(CLOCK_MONOTONIC, &tv);
    • Linux: clock_gettime(CLOCK_BOOTTIME, &tv);
    • Windows: QueryInterruptTime(&ticks);
  • The ACPI timer can be used as a clock reference even on older desktops.
  • Processors:
    • x86, x86-64: HPET, rdtsc * base frequency on modern processors
    • ARM: Generic Timer system register
    • RISC-V: memory-mapped mtime
    • AVR doesn't natively, but real-time clock peripherals are pervasive, and Arduinos have them built-in.
    • Others also have their various ways - just look at the Linux VDSO clock_gettime implementations for various architectures.

I propose something like an atomic.clock.get that returns an i64 nanosecond count, to align with the existing wait opcodes.

Ngôn ngữ chính
WebAssembly
Star
767
Fork
54
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WebAssembly/threads

Tất cả issue của WebAssembly/threads

Issue tương tự

Thêm issue về Operating Systems

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.