Skip to content

Commit

Permalink
rollback async_callback signature
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Oct 8, 2023
1 parent e6b3996 commit 65bd76b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/xtd.core/include/xtd/delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace xtd {
/// @par Library
/// xtd.core
/// @ingroup xtd_core
using async_callback = delegate<void(const iasync_result& ar)>;
using async_callback = delegate<void(async_result ar)>;

/// @brief Represents a delegate, which is a data structure that refers to a static method or to a class instance && an instance method of that class.
/// @par Header
Expand Down
4 changes: 2 additions & 2 deletions src/xtd.core/include/xtd/internal/__delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ xtd::async_result xtd::delegate<result_t()>::begin_invoke(xtd::async_callback as
async->data_->result = __xtd_delegate_invoker(function_t {std::bind(&xtd::delegate<result_t()>::invoke, this)});
async->data_->is_completed = true;
async->data_->async_event.set();
async->data_->async_callback(*async);
async->data_->async_callback(async);
});
return async;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ xtd::async_result xtd::delegate<result_t(arguments_t...)>::begin_invoke(xtd::asy
async->data_->result = __xtd_delegate_invoker(function_t {std::bind(&xtd::delegate<result_t(arguments_t...)>::invoke, this, arguments...)}, arguments...);
async->data_->is_completed = true;
async->data_->async_event.set();
async->data_->async_callback(*async);
async->data_->async_callback(async);
});
return async;
}
Expand Down
20 changes: 10 additions & 10 deletions src/xtd.core/src/xtd/net/sockets/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_accept(xtd::async_callback cal
ar->socket_ = s.accept();
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand Down Expand Up @@ -369,7 +369,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_disconnect(bool reuse_socket,
s.disconnect(reuse_socket);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -391,7 +391,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_receive(std::vector<xtd::byte>
ar->number_of_bytes_received_ = s.receive(*buffer, offset, size, socket_flags);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -413,7 +413,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_receive(std::vector<xtd::byte>
ar->number_of_bytes_received_ = s.receive(*buffer, offset, size, socket_flags, ar->error_code_);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -435,7 +435,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_receive_from(std::vector<xtd::
ar->number_of_bytes_received_ = s.receive_from(*buffer, offset, size, socket_flags, *ar->end_point_);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -458,7 +458,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_receive_message_from(std::vect
ar->number_of_bytes_received_ = s.receive_message_from(*buffer, offset, size, ar->socket_flags_, *ar->end_point_, ar->ip_packet_information_);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -480,7 +480,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_send(const std::vector<xtd::by
ar->number_of_bytes_sent_ = s.send(buffer, offset, size, socket_flags);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -502,7 +502,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_send(const std::vector<xtd::by
ar->number_of_bytes_sent_ = s.send(buffer, offset, size, socket_flags, ar->error_code_);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand All @@ -523,7 +523,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_send_to(const std::vector<xtd:
ar->number_of_bytes_sent_ = s.send_to(buffer, offset, size, socket_flags, remote_end_point);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand Down Expand Up @@ -950,7 +950,7 @@ std::shared_ptr<xtd::iasync_result> socket::begin_connect_(std::shared_ptr<xtd::
s.connect_(remote_end_point);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->error_code_ = s.get_last_error_();
ar->exception_ = current_exception();
Expand Down
4 changes: 2 additions & 2 deletions src/xtd.core/src/xtd/net/sockets/tcp_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::shared_ptr<xtd::iasync_result> tcp_listener::begin_accept_socket(xtd::async
ar->socket_ = listener->accept_socket();
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand All @@ -83,7 +83,7 @@ std::shared_ptr<xtd::iasync_result> tcp_listener::begin_accept_tcp_client(xtd::a
ar->tcp_client_ = listener->accept_tcp_client();
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand Down
8 changes: 4 additions & 4 deletions src/xtd.core/src/xtd/net/sockets/udp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ std::shared_ptr<xtd::iasync_result> udp_client::begin_receive(xtd::async_callbac
ar->buffer_ = udp_client->receive(ar->remote_end_point_);
ar->is_completed_ = true;
as<threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand All @@ -139,7 +139,7 @@ std::shared_ptr<xtd::iasync_result> udp_client::begin_send(const std::vector<xtd
ar->number_of_bytes_sent_ = udp_client->send(dgram, bytes, hostname, port);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand All @@ -156,7 +156,7 @@ std::shared_ptr<xtd::iasync_result> udp_client::begin_send(const std::vector<xtd
ar->number_of_bytes_sent_ = udp_client->send(dgram, bytes, end_point);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand All @@ -173,7 +173,7 @@ std::shared_ptr<xtd::iasync_result> udp_client::begin_send(const std::vector<xtd
ar->number_of_bytes_sent_ = udp_client->send(dgram, bytes);
ar->is_completed_ = true;
as<xtd::threading::mutex>(ar->async_wait_handle()).release_mutex();
callback(*ar);
callback(ar);
} catch (...) {
ar->exception_ = current_exception();
}
Expand Down

0 comments on commit 65bd76b

Please sign in to comment.