Skip to content

Commit

Permalink
Merge branch 'grand_dispatch_queue' of github.com:awslabs/aws-c-io in…
Browse files Browse the repository at this point in the history
…to nw_socket
  • Loading branch information
xiazhvera committed Nov 9, 2024
2 parents 28b7546 + 1212977 commit 351c682
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if (WIN32)
)
list(APPEND AWS_IO_OS_SRC ${AWS_IO_IOCP_SRC})

set(EVENT_LOOP_DEFINE "IO_COMPLETION_PORTS")
list(APPEND EVENT_LOOP_DEFINES "IO_COMPLETION_PORTS")
endif ()

if (MSVC)
Expand All @@ -101,7 +101,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Androi
)
set(PLATFORM_LIBS "")

set(EVENT_LOOP_DEFINE "EPOLL")
list(APPEND EVENT_LOOP_DEFINES "EPOLL")
set(USE_S2N ON)

elseif (APPLE)
Expand All @@ -125,7 +125,7 @@ elseif (APPLE)

#No choice on TLS for apple, darwinssl will always be used.
list(APPEND PLATFORM_LIBS "-framework Security -framework Network")
set(EVENT_LOOP_DEFINES "DISPATCH_QUEUE" )
list(APPEND EVENT_LOOP_DEFINES "DISPATCH_QUEUE")

# Enable KQUEUE on MacOS
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand All @@ -134,7 +134,7 @@ elseif (APPLE)
"source/posix/*.c"
)
list(APPEND AWS_IO_OS_SRC ${AWS_IO_KUEUE_SRC})
set(EVENT_LOOP_DEFINE "KQUEUE")
list(APPEND EVENT_LOOP_DEFINES "KQUEUE")
endif()

elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
Expand All @@ -146,7 +146,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetB
"source/posix/*.c"
)

set(EVENT_LOOP_DEFINE "KQUEUE")
list(APPEND EVENT_LOOP_DEFINES "KQUEUE")
set(USE_S2N ON)

endif()
Expand Down Expand Up @@ -199,7 +199,9 @@ aws_add_sanitizers(${PROJECT_NAME})
# We are not ABI stable yet
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0)

target_compile_definitions(${PROJECT_NAME} PUBLIC "-DAWS_ENABLE_${EVENT_LOOP_DEFINE}")
foreach(EVENT_LOOP_DEFINE IN LISTS EVENT_LOOP_DEFINES)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DAWS_ENABLE_${EVENT_LOOP_DEFINE}")
endforeach()

if (BYO_CRYPTO)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DBYO_CRYPTO")
Expand Down
2 changes: 0 additions & 2 deletions source/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ static int aws_event_loop_type_validate_platform(enum aws_event_loop_type type)
return AWS_OP_SUCCESS;
}

#ifndef AWS_ENABLE_DISPATCH_QUEUE
struct aws_event_loop *aws_event_loop_new_dispatch_queue_with_options(
struct aws_allocator *alloc,
const struct aws_event_loop_options *options) {
Expand All @@ -629,7 +628,6 @@ struct aws_event_loop *aws_event_loop_new_dispatch_queue_with_options(
AWS_LOGF_DEBUG(AWS_LS_IO_EVENT_LOOP, "Dispatch Queue is not supported on the platform");
return NULL;
}
#endif // AWS_ENABLE_DISPATCH_QUEUE

#ifndef AWS_ENABLE_IO_COMPLETION_PORTS
struct aws_event_loop *aws_event_loop_new_iocp_with_options(
Expand Down
2 changes: 0 additions & 2 deletions source/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ int aws_socket_init_winsock(
}
#endif

#ifndef AWS_ENABLE_DISPATCH_QUEUE
int aws_socket_init_apple_nw_socket(
struct aws_socket *socket,
struct aws_allocator *alloc,
Expand All @@ -271,4 +270,3 @@ int aws_socket_init_apple_nw_socket(
AWS_LOGF_DEBUG(AWS_LS_IO_SOCKET, "Apple Network Framework is not supported on the platform.");
return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED);
}
#endif

0 comments on commit 351c682

Please sign in to comment.