#thread #pthreads #no-std #mingw

no-std hipthread

no-std thread library based on pthread

1 unstable release

new 0.1.0 Dec 20, 2024

#468 in Concurrency

MIT/Apache

37KB
1K SLoC

hipthread

在no-std环境下,封装unix的pthread和mingw的winpthread, 可支持unix和windows.

当前仅包含如下功能:

  1. spawn/spawn_with: 创建线程
  2. ThrdLocal: TLS变量的存取.
  3. Mutex: 互斥锁
  4. Once/OnceLock/LazyLock: 类似std库中的同名类功能.
  5. sched_cpu_count: 获取当前进程可用的核数量.
  6. sched_getaffinity/sched_setaffinity: 设置当前进程同cpu核的亲和性
  7. thrd_setaffinity: 设置当前线程同cpu核的亲和性.
  8. thrd_setname/thrd_getname: 设置获取当前线程的名字,方便调测.

Dependencies

~170KB