aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/closure.h
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2016-06-30 15:37:11 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2016-06-30 15:37:11 -0700
commitc93d6a66a12110f82882807d95ad5dcb02370151 (patch)
treeefb5e632e8ad237e05d63af14e54c2a8d83ad87b /src/core/lib/iomgr/closure.h
parent095172c3a52a11c42aed0150eb8dbb47186fd2a0 (diff)
parenta5596db1a53723789d7c90c23d9cbfbb8207f949 (diff)
Merge master into merge-0.14-into-master
Conflicts: - gRPC.podspec - Only had non-trivial changes in the core file list, which will need to be regenerated (in gRPC-Core.podspec). - src/objective-c/BoringSSL.podspec - Had trivial conflicts in the version. - src/objective-c/examples/RemoteTestClient/RemoteTest.podspec - Trivial conflicts in quoting. - src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj and src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj - The master version is used, pending testing. The 0.14 version had emoji and some unneeded entries. - src/objective-c/tests/Podfile - Added CronetFramework pod, and warning silencing from master. - templates/gRPC.podspec.template - Deleted. - third_party/protobuf - Using master commit, but need to verify if it works for frameworks.
Diffstat (limited to 'src/core/lib/iomgr/closure.h')
-rw-r--r--src/core/lib/iomgr/closure.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h
index fdc2daed9d..08e59a168e 100644
--- a/src/core/lib/iomgr/closure.h
+++ b/src/core/lib/iomgr/closure.h
@@ -36,6 +36,7 @@
#include <grpc/support/port_platform.h>
#include <stdbool.h>
+#include "src/core/lib/iomgr/error.h"
struct grpc_closure;
typedef struct grpc_closure grpc_closure;
@@ -52,10 +53,10 @@ typedef struct grpc_closure_list {
/** gRPC Callback definition.
*
* \param arg Arbitrary input.
- * \param success An indication on the state of the iomgr. On false, cleanup
- * actions should be taken (eg, shutdown). */
+ * \param error GRPC_ERROR_NONE if no error occurred, otherwise some grpc_error
+ * describing what went wrong */
typedef void (*grpc_iomgr_cb_func)(grpc_exec_ctx *exec_ctx, void *arg,
- bool success);
+ grpc_error *error);
/** A closure over a grpc_iomgr_cb_func. */
struct grpc_closure {
@@ -65,10 +66,15 @@ struct grpc_closure {
/** Arguments to be passed to "cb". */
void *cb_arg;
- /** Once enqueued, contains in the lower bit the success of the closure,
- and in the upper bits the pointer to the next closure in the list.
- Before enqueing for execution, this is usable for scratch data. */
- uintptr_t final_data;
+ /** Once queued, the result of the closure. Before then: scratch space */
+ grpc_error *error;
+
+ /** Once queued, next indicates the next queued closure; before then, scratch
+ * space */
+ union {
+ grpc_closure *next;
+ uintptr_t scratch;
+ } next_data;
};
/** Initializes \a closure with \a cb and \a cb_arg. */
@@ -81,13 +87,14 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg);
#define GRPC_CLOSURE_LIST_INIT \
{ NULL, NULL }
-/** add \a closure to the end of \a list and set \a closure's success to \a
- * success */
-void grpc_closure_list_add(grpc_closure_list *list, grpc_closure *closure,
- bool success);
+/** add \a closure to the end of \a list
+ and set \a closure's result to \a error */
+void grpc_closure_list_append(grpc_closure_list *list, grpc_closure *closure,
+ grpc_error *error);
/** force all success bits in \a list to false */
-void grpc_closure_list_fail_all(grpc_closure_list *list);
+void grpc_closure_list_fail_all(grpc_closure_list *list,
+ grpc_error *forced_failure);
/** append all closures from \a src to \a dst and empty \a src. */
void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst);
@@ -95,7 +102,4 @@ void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst);
/** return whether \a list is empty. */
bool grpc_closure_list_empty(grpc_closure_list list);
-/** return the next pointer for a queued closure list */
-grpc_closure *grpc_closure_next(grpc_closure *closure);
-
#endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */