@@ -133,7 +133,7 @@ class TemporalThreadAffinity // speedup trick for Linux, FreeBSD, DragonFlyBSD,
133
133
TemporalThreadAffinity (); // forbidden
134
134
#if defined(__FreeBSD__) || (defined(__DragonFly__) && __DragonFly_version >= 400707)
135
135
cpu_set_t old_affinity;
136
- const bool restore;
136
+ bool restore;
137
137
138
138
public:
139
139
TemporalThreadAffinity (uint32 core_id, bool checkStatus = true , const bool restore_ = true )
@@ -152,6 +152,7 @@ class TemporalThreadAffinity // speedup trick for Linux, FreeBSD, DragonFlyBSD,
152
152
// CPU_CMP() returns true if old_affinity is NOT equal to new_affinity
153
153
if (!(CPU_CMP (&old_affinity, &new_affinity)))
154
154
{
155
+ restore = false ;
155
156
return ; // the same affinity => return
156
157
}
157
158
res = pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t ), &new_affinity);
@@ -171,7 +172,7 @@ class TemporalThreadAffinity // speedup trick for Linux, FreeBSD, DragonFlyBSD,
171
172
cpu_set_t * old_affinity;
172
173
static constexpr auto maxCPUs = 8192 ;
173
174
const size_t set_size;
174
- const bool restore;
175
+ bool restore;
175
176
176
177
public:
177
178
TemporalThreadAffinity (const uint32 core_id, bool checkStatus = true , const bool restore_ = true )
@@ -193,6 +194,7 @@ class TemporalThreadAffinity // speedup trick for Linux, FreeBSD, DragonFlyBSD,
193
194
if (CPU_EQUAL_S (set_size, old_affinity, new_affinity))
194
195
{
195
196
CPU_FREE (new_affinity);
197
+ restore = false ;
196
198
return ;
197
199
}
198
200
res = pthread_setaffinity_np (pthread_self (), set_size, new_affinity);
0 commit comments