Skip to content

Commit

Permalink
handle duplicate functions related to darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
sbSteveK committed Dec 4, 2024
1 parent aa21e8b commit 5c211f1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions source/darwin/dispatch_queue_event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ static struct aws_string *s_get_unique_dispatch_queue_id(struct aws_allocator *a
return result;
}

#if defined(aws_event_loop_new_with_dispatch_queue)
/* Setup a dispatch_queue with a scheduler. */
struct aws_event_loop *aws_event_loop_new_with_dispatch_queue(
struct aws_allocator *alloc,
Expand Down Expand Up @@ -222,6 +223,8 @@ struct aws_event_loop *aws_event_loop_new_with_dispatch_queue(
return NULL;
}

#endif // AWS_ENABLE_DISPATCH_QUEUE

static void s_dispatch_queue_destroy_task(void *context) {
struct dispatch_loop *dispatch_loop = context;

Expand Down
2 changes: 2 additions & 0 deletions source/darwin/nw_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ static void s_socket_impl_destroy(void *sock_ptr) {
nw_socket = NULL;
}

#if defined(AWS_ENABLE_DISPATCH_QUEUE)
int aws_socket_init_apple_nw_socket(
struct aws_socket *socket,
struct aws_allocator *alloc,
Expand Down Expand Up @@ -737,6 +738,7 @@ int aws_socket_init_apple_nw_socket(

return AWS_OP_SUCCESS;
}
#endif // AWS_ENABLE_DISPATCH_QUEUE

static void s_client_set_dispatch_queue(struct aws_io_handle *handle, void *queue) {
nw_connection_set_queue(handle->data.handle, queue);
Expand Down
1 change: 1 addition & 0 deletions source/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ enum aws_event_loop_type aws_event_loop_get_default_type(void) {
AWS_LOGF_ERROR(
AWS_LS_IO_EVENT_LOOP,
"Failed to get default event loop type. The library is not built correctly on the platform.");
return AWS_EVENT_LOOP_PLATFORM_DEFAULT;
#endif
}

Expand Down
3 changes: 2 additions & 1 deletion source/posix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,15 @@ static int s_socket_init(

return AWS_OP_SUCCESS;
}

#if defined(AWS_ENABLE_KQUEUE) || defined(AWS_ENABLE_EPOLL)
int aws_socket_init_posix(
struct aws_socket *socket,
struct aws_allocator *alloc,
const struct aws_socket_options *options) {
AWS_ASSERT(options);
return s_socket_init(socket, alloc, options, -1);
}
#endif // AWS_ENABLE_KQUEUE || AWS_ENABLE_EPOLL

static void s_socket_clean_up(struct aws_socket *socket) {
if (!socket->impl) {
Expand Down
4 changes: 2 additions & 2 deletions source/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static int aws_socket_impl_type_validate_platform(enum aws_socket_impl_type type
return AWS_OP_SUCCESS;
}

#if !defined(AWS_ENABLE_EPOLL) && !defined(AWS_ENABLE_KQUEUE) && !defined(AWS_USE_SECITEM)
#if !defined(AWS_ENABLE_EPOLL) && !defined(AWS_ENABLE_KQUEUE)
int aws_socket_init_posix(
struct aws_socket *socket,
struct aws_allocator *alloc,
Expand All @@ -238,7 +238,7 @@ int aws_socket_init_posix(
AWS_LOGF_DEBUG(AWS_LS_IO_SOCKET, "Posix socket is not supported on the platform.");
return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED);
}
#endif
#endif // !AWS_ENABLE_EPOLL && !AWS_ENABLE_KQUEUE

#ifndef AWS_ENABLE_IO_COMPLETION_PORTS
int aws_socket_init_winsock(
Expand Down

0 comments on commit 5c211f1

Please sign in to comment.