10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*6936Ssommerfe * Common Development and Distribution License (the "License"). 6*6936Ssommerfe * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*6936Ssommerfe * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _CTFMERGE_H 270Sstevel@tonic-gate #define _CTFMERGE_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * Merging structures used in ctfmerge. See ctfmerge.c for locking semantics. 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <pthread.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef __cplusplus 380Sstevel@tonic-gate extern "C" { 390Sstevel@tonic-gate #endif 400Sstevel@tonic-gate 410Sstevel@tonic-gate #include "ctftools.h" 420Sstevel@tonic-gate #include "barrier.h" 430Sstevel@tonic-gate #include "fifo.h" 440Sstevel@tonic-gate 450Sstevel@tonic-gate typedef struct wip { 460Sstevel@tonic-gate pthread_mutex_t wip_lock; 470Sstevel@tonic-gate pthread_cond_t wip_cv; 480Sstevel@tonic-gate tdata_t *wip_td; 490Sstevel@tonic-gate int wip_nmerged; 500Sstevel@tonic-gate int wip_batchid; 510Sstevel@tonic-gate } wip_t; 520Sstevel@tonic-gate 530Sstevel@tonic-gate typedef struct workqueue { 540Sstevel@tonic-gate int wq_next_batchid; 550Sstevel@tonic-gate 560Sstevel@tonic-gate int wq_maxbatchsz; 570Sstevel@tonic-gate 580Sstevel@tonic-gate wip_t *wq_wip; 590Sstevel@tonic-gate int wq_nwipslots; 600Sstevel@tonic-gate int wq_nthreads; 610Sstevel@tonic-gate int wq_ithrottle; 620Sstevel@tonic-gate 630Sstevel@tonic-gate pthread_mutex_t wq_queue_lock; 640Sstevel@tonic-gate fifo_t *wq_queue; 650Sstevel@tonic-gate pthread_cond_t wq_work_avail; 660Sstevel@tonic-gate pthread_cond_t wq_work_removed; 670Sstevel@tonic-gate int wq_ninqueue; 680Sstevel@tonic-gate int wq_nextpownum; 690Sstevel@tonic-gate 700Sstevel@tonic-gate pthread_mutex_t wq_donequeue_lock; 710Sstevel@tonic-gate fifo_t *wq_donequeue; 720Sstevel@tonic-gate int wq_lastdonebatch; 730Sstevel@tonic-gate pthread_cond_t wq_done_cv; 740Sstevel@tonic-gate 750Sstevel@tonic-gate pthread_cond_t wq_alldone_cv; /* protected by queue_lock */ 760Sstevel@tonic-gate int wq_alldone; 770Sstevel@tonic-gate 780Sstevel@tonic-gate int wq_nomorefiles; 790Sstevel@tonic-gate 80*6936Ssommerfe pthread_t *wq_thread; 81*6936Ssommerfe 820Sstevel@tonic-gate barrier_t wq_bar1; 830Sstevel@tonic-gate barrier_t wq_bar2; 840Sstevel@tonic-gate } workqueue_t; 850Sstevel@tonic-gate 860Sstevel@tonic-gate #ifdef __cplusplus 870Sstevel@tonic-gate } 880Sstevel@tonic-gate #endif 890Sstevel@tonic-gate 900Sstevel@tonic-gate #endif /* _CTFMERGE_H */ 91