OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * |
| 3 * Copyright 2015-2016, Google Inc. |
| 4 * All rights reserved. |
| 5 * |
| 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are |
| 8 * met: |
| 9 * |
| 10 * * Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above |
| 13 * copyright notice, this list of conditions and the following disclaimer |
| 14 * in the documentation and/or other materials provided with the |
| 15 * distribution. |
| 16 * * Neither the name of Google Inc. nor the names of its |
| 17 * contributors may be used to endorse or promote products derived from |
| 18 * this software without specific prior written permission. |
| 19 * |
| 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 32 */ |
| 33 |
| 34 #ifndef GRPC_INTERNAL_CORE_IOMGR_WORKQUEUE_H |
| 35 #define GRPC_INTERNAL_CORE_IOMGR_WORKQUEUE_H |
| 36 |
| 37 #include "src/core/iomgr/iomgr.h" |
| 38 #include "src/core/iomgr/pollset.h" |
| 39 #include "src/core/iomgr/closure.h" |
| 40 #include "src/core/iomgr/exec_ctx.h" |
| 41 |
| 42 #ifdef GPR_POSIX_SOCKET |
| 43 #include "src/core/iomgr/workqueue_posix.h" |
| 44 #endif |
| 45 |
| 46 #ifdef GPR_WIN32 |
| 47 #include "src/core/iomgr/workqueue_windows.h" |
| 48 #endif |
| 49 |
| 50 /* grpc_workqueue is forward declared in exec_ctx.h */ |
| 51 |
| 52 /** Create a work queue */ |
| 53 grpc_workqueue *grpc_workqueue_create(grpc_exec_ctx *exec_ctx); |
| 54 |
| 55 void grpc_workqueue_flush(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue); |
| 56 |
| 57 #define GRPC_WORKQUEUE_REFCOUNT_DEBUG |
| 58 #ifdef GRPC_WORKQUEUE_REFCOUNT_DEBUG |
| 59 #define GRPC_WORKQUEUE_REF(p, r) \ |
| 60 grpc_workqueue_ref((p), __FILE__, __LINE__, (r)) |
| 61 #define GRPC_WORKQUEUE_UNREF(cl, p, r) \ |
| 62 grpc_workqueue_unref((cl), (p), __FILE__, __LINE__, (r)) |
| 63 void grpc_workqueue_ref(grpc_workqueue *workqueue, const char *file, int line, |
| 64 const char *reason); |
| 65 void grpc_workqueue_unref(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue, |
| 66 const char *file, int line, const char *reason); |
| 67 #else |
| 68 #define GRPC_WORKQUEUE_REF(p, r) grpc_workqueue_ref((p)) |
| 69 #define GRPC_WORKQUEUE_UNREF(cl, p, r) grpc_workqueue_unref((cl), (p)) |
| 70 void grpc_workqueue_ref(grpc_workqueue *workqueue); |
| 71 void grpc_workqueue_unref(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue); |
| 72 #endif |
| 73 |
| 74 /** Bind this workqueue to a pollset */ |
| 75 void grpc_workqueue_add_to_pollset(grpc_exec_ctx *exec_ctx, |
| 76 grpc_workqueue *workqueue, |
| 77 grpc_pollset *pollset); |
| 78 |
| 79 /** Add a work item to a workqueue */ |
| 80 void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure, |
| 81 int success); |
| 82 |
| 83 #endif |
OLD | NEW |