11673e404SJohn Birrell /* 21673e404SJohn Birrell * CDDL HEADER START 31673e404SJohn Birrell * 41673e404SJohn Birrell * The contents of this file are subject to the terms of the 5*1670a1c2SRui Paulo * Common Development and Distribution License (the "License"). 6*1670a1c2SRui Paulo * You may not use this file except in compliance with the License. 71673e404SJohn Birrell * 81673e404SJohn Birrell * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91673e404SJohn Birrell * or http://www.opensolaris.org/os/licensing. 101673e404SJohn Birrell * See the License for the specific language governing permissions 111673e404SJohn Birrell * and limitations under the License. 121673e404SJohn Birrell * 131673e404SJohn Birrell * When distributing Covered Code, include this CDDL HEADER in each 141673e404SJohn Birrell * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151673e404SJohn Birrell * If applicable, add the following below this CDDL HEADER, with the 161673e404SJohn Birrell * fields enclosed by brackets "[]" replaced with your own identifying 171673e404SJohn Birrell * information: Portions Copyright [yyyy] [name of copyright owner] 181673e404SJohn Birrell * 191673e404SJohn Birrell * CDDL HEADER END 201673e404SJohn Birrell */ 211673e404SJohn Birrell /* 22*1670a1c2SRui Paulo * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 231673e404SJohn Birrell * Use is subject to license terms. 241673e404SJohn Birrell */ 251673e404SJohn Birrell 261673e404SJohn Birrell #ifndef _CTFMERGE_H 271673e404SJohn Birrell #define _CTFMERGE_H 281673e404SJohn Birrell 291673e404SJohn Birrell #pragma ident "%Z%%M% %I% %E% SMI" 301673e404SJohn Birrell 311673e404SJohn Birrell /* 321673e404SJohn Birrell * Merging structures used in ctfmerge. See ctfmerge.c for locking semantics. 331673e404SJohn Birrell */ 341673e404SJohn Birrell 351673e404SJohn Birrell #include <pthread.h> 361673e404SJohn Birrell 371673e404SJohn Birrell #ifdef __cplusplus 381673e404SJohn Birrell extern "C" { 391673e404SJohn Birrell #endif 401673e404SJohn Birrell 411673e404SJohn Birrell #include "ctftools.h" 421673e404SJohn Birrell #include "barrier.h" 431673e404SJohn Birrell #include "fifo.h" 441673e404SJohn Birrell 451673e404SJohn Birrell typedef struct wip { 461673e404SJohn Birrell pthread_mutex_t wip_lock; 471673e404SJohn Birrell pthread_cond_t wip_cv; 481673e404SJohn Birrell tdata_t *wip_td; 491673e404SJohn Birrell int wip_nmerged; 501673e404SJohn Birrell int wip_batchid; 511673e404SJohn Birrell } wip_t; 521673e404SJohn Birrell 531673e404SJohn Birrell typedef struct workqueue { 541673e404SJohn Birrell int wq_next_batchid; 551673e404SJohn Birrell 561673e404SJohn Birrell int wq_maxbatchsz; 571673e404SJohn Birrell 581673e404SJohn Birrell wip_t *wq_wip; 591673e404SJohn Birrell int wq_nwipslots; 601673e404SJohn Birrell int wq_nthreads; 611673e404SJohn Birrell int wq_ithrottle; 621673e404SJohn Birrell 631673e404SJohn Birrell pthread_mutex_t wq_queue_lock; 641673e404SJohn Birrell fifo_t *wq_queue; 651673e404SJohn Birrell pthread_cond_t wq_work_avail; 661673e404SJohn Birrell pthread_cond_t wq_work_removed; 671673e404SJohn Birrell int wq_ninqueue; 681673e404SJohn Birrell int wq_nextpownum; 691673e404SJohn Birrell 701673e404SJohn Birrell pthread_mutex_t wq_donequeue_lock; 711673e404SJohn Birrell fifo_t *wq_donequeue; 721673e404SJohn Birrell int wq_lastdonebatch; 731673e404SJohn Birrell pthread_cond_t wq_done_cv; 741673e404SJohn Birrell 751673e404SJohn Birrell pthread_cond_t wq_alldone_cv; /* protected by queue_lock */ 761673e404SJohn Birrell int wq_alldone; 771673e404SJohn Birrell 781673e404SJohn Birrell int wq_nomorefiles; 791673e404SJohn Birrell 80*1670a1c2SRui Paulo pthread_t *wq_thread; 81*1670a1c2SRui Paulo 821673e404SJohn Birrell barrier_t wq_bar1; 831673e404SJohn Birrell barrier_t wq_bar2; 841673e404SJohn Birrell } workqueue_t; 851673e404SJohn Birrell 861673e404SJohn Birrell #ifdef __cplusplus 871673e404SJohn Birrell } 881673e404SJohn Birrell #endif 891673e404SJohn Birrell 901673e404SJohn Birrell #endif /* _CTFMERGE_H */ 91