文件名称:lqueue:C11 + Pthreads 原子有界工作队列
文件大小:10KB
文件格式:ZIP
更新时间:2024-06-19 18:19:45
C
C11 + Pthreads 原子有界工作队列 这是一个使用 C11 的stdatomic.h特性提供单写入器、多读取器无锁队列 (lqueue) 的小型库。 该队列使用 POSIX 线程和信号量封装在多线程工作队列 (wqueue) 中。 功能指针/参数元组形式的作业被提交到队列,并由队列的线程完成,在队列已满时根据需要阻塞。 struct sha1_job { char message[ 64 ]; char hash[SHA1_DIGEST_SIZE * 2 + 1 ]; }; static void sha1_worker ( int thread_id, void *arg) { /* ... compute hashes ... */ } void sha1_compute_all ( void ) { int nthreads = sysc
【文件预览】:
lqueue-master
----lqueue.h(564B)
----main.c(1KB)
----wqueue.c(3KB)
----wqueue.h(1KB)
----lqueue.c(1KB)
----sha1.h(569B)
----sha1.c(11KB)
----UNLICENSE(1KB)
----.gitignore(9B)
----Makefile(284B)
----README.md(1KB)