168349Sobrien/* 2133359Sobrien * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>. 3133359Sobrien * All rights reserved. 4133359Sobrien * 5226048Sobrien * Redistribution and use in source and binary forms, with or without 6133359Sobrien * modification, are permitted provided that the following conditions 7133359Sobrien * are met: 8133359Sobrien * 1. Redistributions of source code must retain the above copyright 9133359Sobrien * notice(s), this list of conditions and the following disclaimer as 10133359Sobrien * the first lines of this file unmodified other than the possible 11133359Sobrien * addition of one or more copyright notices. 12133359Sobrien * 2. Redistributions in binary form must reproduce the above copyright 13133359Sobrien * notice(s), this list of conditions and the following disclaimer in 14133359Sobrien * the documentation and/or other materials provided with the 15226048Sobrien * distribution. 16133359Sobrien * 17133359Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 18133359Sobrien * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19133359Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20133359Sobrien * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 21133359Sobrien * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22133359Sobrien * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23133359Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24133359Sobrien * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25133359Sobrien * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26133359Sobrien * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27133359Sobrien * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28133359Sobrien * 2968349Sobrien * $FreeBSD$ 3068349Sobrien */ 3168349Sobrien 3268349Sobrien#include <pthread.h> 3368349Sobrien#include "thr_private.h" 3468349Sobrien 3568349Sobrienextern int __wait(int *); 3668349Sobrien 3768349Sobrienpid_t _wait(int *istat); 3868349Sobrien 3968349Sobrien__weak_reference(_wait, wait); 40103373Sobrien 41191736Sobrienpid_t 42191736Sobrien_wait(int *istat) 43226048Sobrien{ 44191736Sobrien struct pthread *curthread = _get_curthread(); 45191736Sobrien pid_t ret; 46133359Sobrien 4768349Sobrien _thr_cancel_enter(curthread); 4868349Sobrien ret = __wait(istat); 4968349Sobrien _thr_cancel_leave(curthread, 1); 5068349Sobrien 5168349Sobrien return ret; 5268349Sobrien} 53133359Sobrien