17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*8168dffcSsommerfe * Common Development and Distribution License (the "License"). 6*8168dffcSsommerfe * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*8168dffcSsommerfe * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _CTFMERGE_H 277c478bd9Sstevel@tonic-gate #define _CTFMERGE_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* 327c478bd9Sstevel@tonic-gate * Merging structures used in ctfmerge. See ctfmerge.c for locking semantics. 337c478bd9Sstevel@tonic-gate */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <pthread.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #include "ctftools.h" 427c478bd9Sstevel@tonic-gate #include "barrier.h" 437c478bd9Sstevel@tonic-gate #include "fifo.h" 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate typedef struct wip { 467c478bd9Sstevel@tonic-gate pthread_mutex_t wip_lock; 477c478bd9Sstevel@tonic-gate pthread_cond_t wip_cv; 487c478bd9Sstevel@tonic-gate tdata_t *wip_td; 497c478bd9Sstevel@tonic-gate int wip_nmerged; 507c478bd9Sstevel@tonic-gate int wip_batchid; 517c478bd9Sstevel@tonic-gate } wip_t; 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate typedef struct workqueue { 547c478bd9Sstevel@tonic-gate int wq_next_batchid; 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate int wq_maxbatchsz; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate wip_t *wq_wip; 597c478bd9Sstevel@tonic-gate int wq_nwipslots; 607c478bd9Sstevel@tonic-gate int wq_nthreads; 617c478bd9Sstevel@tonic-gate int wq_ithrottle; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate pthread_mutex_t wq_queue_lock; 647c478bd9Sstevel@tonic-gate fifo_t *wq_queue; 657c478bd9Sstevel@tonic-gate pthread_cond_t wq_work_avail; 667c478bd9Sstevel@tonic-gate pthread_cond_t wq_work_removed; 677c478bd9Sstevel@tonic-gate int wq_ninqueue; 687c478bd9Sstevel@tonic-gate int wq_nextpownum; 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate pthread_mutex_t wq_donequeue_lock; 717c478bd9Sstevel@tonic-gate fifo_t *wq_donequeue; 727c478bd9Sstevel@tonic-gate int wq_lastdonebatch; 737c478bd9Sstevel@tonic-gate pthread_cond_t wq_done_cv; 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate pthread_cond_t wq_alldone_cv; /* protected by queue_lock */ 767c478bd9Sstevel@tonic-gate int wq_alldone; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate int wq_nomorefiles; 797c478bd9Sstevel@tonic-gate 80*8168dffcSsommerfe pthread_t *wq_thread; 81*8168dffcSsommerfe 827c478bd9Sstevel@tonic-gate barrier_t wq_bar1; 837c478bd9Sstevel@tonic-gate barrier_t wq_bar2; 847c478bd9Sstevel@tonic-gate } workqueue_t; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #ifdef __cplusplus 877c478bd9Sstevel@tonic-gate } 887c478bd9Sstevel@tonic-gate #endif 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #endif /* _CTFMERGE_H */ 91