Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
6a1704f0
Commit
6a1704f0
authored
Dec 21, 2023
by
Eurecom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C and C++
parent
d17d22c1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
common/utils/thread_pool/task.h
common/utils/thread_pool/task.h
+7
-0
common/utils/thread_pool/task_manager.h
common/utils/thread_pool/task_manager.h
+11
-3
No files found.
common/utils/thread_pool/task.h
View file @
6a1704f0
#ifndef TASK_WORK_STEALING_THREAD_POOL_H
#define TASK_WORK_STEALING_THREAD_POOL_H
#ifndef __cplusplus
#include <stdalign.h>
#else
#define _Alignas(X) alignas(X)
#endif
#if defined (__i386__) || defined(__x86_64__)
#define LEVEL1_DCACHE_LINESIZE 64
#elif __aarch64__
...
...
@@ -12,6 +18,7 @@
static_assert
(
0
!=
0
,
"Unknown CPU architecture"
);
#endif
typedef
struct
{
// Avoid false sharing. Doing it in the first member
_Alignas
(
LEVEL1_DCACHE_LINESIZE
)
void
*
args
;
...
...
common/utils/thread_pool/task_manager.h
View file @
6a1704f0
...
...
@@ -14,10 +14,18 @@
#include "task.h"
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#ifndef __cplusplus
#include <stdalign.h>
#include <stdatomic.h>
#else
#include <atomic>
#define _Atomic(X) std::atomic< X >
#define _Alignas(X) alignas(X)
#endif
#if defined (__i386__) || defined(__x86_64__)
#define pause_or_yield __builtin_ia32_pause
#elif __aarch64__
...
...
@@ -42,11 +50,11 @@ typedef struct{
pthread_t
*
t_arr
;
size_t
len_thr
;
atomic_uint_fast64_t
index
;
_Atomic
(
uint64_t
)
index
;
void
*
q_arr
;
atomic_uint_fast64_t
num_task
;
_Atomic
(
uint64_t
)
num_task
;
// pthread_cond_t wait_cv;
// pthread_mutex_t wait_mtx;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment