Skip to content

Commit c7f3492

Browse files
committed
Fix MacOS build
1 parent c62d9df commit c7f3492

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

include/slick/socket/tcp_client_unix.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,31 @@ inline void TCPClientBase<DerivedT>::client_loop()
146146
LOG_INFO("Client loop started");
147147

148148
// Set CPU affinity if specified
149+
#ifndef __APPLE__
149150
if (config_.cpu_affinity >= 0)
150151
{
151152
cpu_set_t cpuset;
152153
CPU_ZERO(&cpuset);
153154
CPU_SET(config_.cpu_affinity, &cpuset);
154-
155+
155156
pthread_t thread = pthread_self();
156157
int result = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
157158
if (result != 0)
158159
{
159-
LOG_WARN("Failed to set CPU affinity to core {}: {}",
160+
LOG_WARN("Failed to set CPU affinity to core {}: {}",
160161
config_.cpu_affinity, std::strerror(result));
161162
}
162163
else
163164
{
164165
LOG_INFO("Client thread pinned to CPU core {}", config_.cpu_affinity);
165166
}
166167
}
168+
#else
169+
if (config_.cpu_affinity >= 0)
170+
{
171+
LOG_WARN("CPU affinity not supported on macOS");
172+
}
173+
#endif
167174

168175
// Connection established - handle server communication
169176
std::vector<uint8_t> buffer(config_.receive_buffer_size);

0 commit comments

Comments
 (0)