Home | History | Annotate | Line # | Download | only in isc
      1 /*	$NetBSD: job_p.h,v 1.2 2025/01/26 16:25:37 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  *
      6  * SPDX-License-Identifier: MPL-2.0
      7  *
      8  * This Source Code Form is subject to the terms of the Mozilla Public
      9  * License, v. 2.0. If a copy of the MPL was not distributed with this
     10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
     11  *
     12  * See the COPYRIGHT file distributed with this work for additional
     13  * information regarding copyright ownership.
     14  */
     15 
     16 #pragma once
     17 
     18 #include <isc/job.h>
     19 #include <isc/loop.h>
     20 #include <isc/os.h>
     21 #include <isc/uv.h>
     22 
     23 /*%
     24  * NOTE: We are using struct __cds_wfcq_head that doesn't have an internal
     25  * mutex, because we are only using enqueue and splice, and those don't need
     26  * any synchronization (see urcu/wfcqueue.h for detailed description).
     27  */
     28 STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(struct __cds_wfcq_head),
     29 	      "ISC_OS_CACHELINE_SIZE smaller than "
     30 	      "sizeof(struct __cds_wfcq_head)");
     31 
     32 typedef struct isc_jobqueue {
     33 	struct __cds_wfcq_head head;
     34 	uint8_t __padding[ISC_OS_CACHELINE_SIZE -
     35 			  sizeof(struct __cds_wfcq_head)];
     36 	struct cds_wfcq_tail tail;
     37 } isc_jobqueue_t;
     38 
     39 typedef ISC_LIST(isc_job_t) isc_joblist_t;
     40 
     41 void
     42 isc__job_cb(uv_idle_t *handle);
     43 
     44 void
     45 isc__job_close(uv_handle_t *handle);
     46