14faae5e9SDavid Xu /* 24faae5e9SDavid Xu * Copyright (c) 2005 David Xu 34faae5e9SDavid Xu * All rights reserved. 44faae5e9SDavid Xu * 54faae5e9SDavid Xu * Redistribution and use in source and binary forms, with or without 64faae5e9SDavid Xu * modification, are permitted provided that the following conditions 74faae5e9SDavid Xu * are met: 84faae5e9SDavid Xu * 1. Redistributions of source code must retain the above copyright 94faae5e9SDavid Xu * notice, this list of conditions and the following disclaimer. 104faae5e9SDavid Xu * 2. Neither the name of the author nor the names of any co-contributors 114faae5e9SDavid Xu * may be used to endorse or promote products derived from this software 124faae5e9SDavid Xu * without specific prior written permission. 134faae5e9SDavid Xu * 144faae5e9SDavid Xu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 154faae5e9SDavid Xu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 164faae5e9SDavid Xu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 174faae5e9SDavid Xu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 184faae5e9SDavid Xu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 194faae5e9SDavid Xu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 204faae5e9SDavid Xu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 214faae5e9SDavid Xu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 224faae5e9SDavid Xu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 234faae5e9SDavid Xu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 244faae5e9SDavid Xu * SUCH DAMAGE. 254faae5e9SDavid Xu * 264faae5e9SDavid Xu * $FreeBSD$ 274faae5e9SDavid Xu */ 284faae5e9SDavid Xu 294faae5e9SDavid Xu #include "thr_private.h" 304faae5e9SDavid Xu 314faae5e9SDavid Xu void 324faae5e9SDavid Xu _thread_bp_create(void) 334faae5e9SDavid Xu { 344faae5e9SDavid Xu } 354faae5e9SDavid Xu 364faae5e9SDavid Xu void 374faae5e9SDavid Xu _thread_bp_death(void) 384faae5e9SDavid Xu { 394faae5e9SDavid Xu } 404faae5e9SDavid Xu 414faae5e9SDavid Xu void 424faae5e9SDavid Xu _thr_report_creation(struct pthread *curthread, struct pthread *newthread) 434faae5e9SDavid Xu { 444faae5e9SDavid Xu curthread->event_buf.event = TD_CREATE; 454faae5e9SDavid Xu curthread->event_buf.th_p = (td_thrhandle_t *)newthread; 464faae5e9SDavid Xu curthread->event_buf.data = 0; 474faae5e9SDavid Xu THR_UMTX_LOCK(curthread, &_thr_event_lock); 484faae5e9SDavid Xu _thread_last_event = curthread; 494faae5e9SDavid Xu _thread_bp_create(); 504faae5e9SDavid Xu _thread_last_event = NULL; 514faae5e9SDavid Xu THR_UMTX_UNLOCK(curthread, &_thr_event_lock); 524faae5e9SDavid Xu } 534faae5e9SDavid Xu 544faae5e9SDavid Xu void 554faae5e9SDavid Xu _thr_report_death(struct pthread *curthread) 564faae5e9SDavid Xu { 574faae5e9SDavid Xu curthread->event_buf.event = TD_DEATH; 584faae5e9SDavid Xu curthread->event_buf.th_p = (td_thrhandle_t *)curthread; 594faae5e9SDavid Xu curthread->event_buf.data = 0; 604faae5e9SDavid Xu THR_UMTX_LOCK(curthread, &_thr_event_lock); 614faae5e9SDavid Xu _thread_last_event = curthread; 624faae5e9SDavid Xu _thread_bp_death(); 634faae5e9SDavid Xu _thread_last_event = NULL; 644faae5e9SDavid Xu THR_UMTX_UNLOCK(curthread, &_thr_event_lock); 654faae5e9SDavid Xu } 66