drd_semaphore.h revision 28230a3734e045791173aca660efc7d7aeef78ce
18564292ac4b9adf51c45517cca2878732feb5bb4sewardj/* 28564292ac4b9adf51c45517cca2878732feb5bb4sewardj This file is part of drd, a data race detector. 38564292ac4b9adf51c45517cca2878732feb5bb4sewardj 48564292ac4b9adf51c45517cca2878732feb5bb4sewardj Copyright (C) 2006-2008 Bart Van Assche 58564292ac4b9adf51c45517cca2878732feb5bb4sewardj bart.vanassche@gmail.com 68564292ac4b9adf51c45517cca2878732feb5bb4sewardj 78564292ac4b9adf51c45517cca2878732feb5bb4sewardj This program is free software; you can redistribute it and/or 88564292ac4b9adf51c45517cca2878732feb5bb4sewardj modify it under the terms of the GNU General Public License as 98564292ac4b9adf51c45517cca2878732feb5bb4sewardj published by the Free Software Foundation; either version 2 of the 108564292ac4b9adf51c45517cca2878732feb5bb4sewardj License, or (at your option) any later version. 118564292ac4b9adf51c45517cca2878732feb5bb4sewardj 128564292ac4b9adf51c45517cca2878732feb5bb4sewardj This program is distributed in the hope that it will be useful, but 138564292ac4b9adf51c45517cca2878732feb5bb4sewardj WITHOUT ANY WARRANTY; without even the implied warranty of 148564292ac4b9adf51c45517cca2878732feb5bb4sewardj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 158564292ac4b9adf51c45517cca2878732feb5bb4sewardj General Public License for more details. 168564292ac4b9adf51c45517cca2878732feb5bb4sewardj 178564292ac4b9adf51c45517cca2878732feb5bb4sewardj You should have received a copy of the GNU General Public License 188564292ac4b9adf51c45517cca2878732feb5bb4sewardj along with this program; if not, write to the Free Software 198564292ac4b9adf51c45517cca2878732feb5bb4sewardj Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 208564292ac4b9adf51c45517cca2878732feb5bb4sewardj 02111-1307, USA. 218564292ac4b9adf51c45517cca2878732feb5bb4sewardj 228564292ac4b9adf51c45517cca2878732feb5bb4sewardj The GNU General Public License is contained in the file COPYING. 238564292ac4b9adf51c45517cca2878732feb5bb4sewardj*/ 248564292ac4b9adf51c45517cca2878732feb5bb4sewardj 258564292ac4b9adf51c45517cca2878732feb5bb4sewardj 268564292ac4b9adf51c45517cca2878732feb5bb4sewardj// Semaphore state information: owner thread and recursion count. 278564292ac4b9adf51c45517cca2878732feb5bb4sewardj 288564292ac4b9adf51c45517cca2878732feb5bb4sewardj 2928230a3734e045791173aca660efc7d7aeef78cebart#ifndef __DRD_SEMAPHORE_H 3028230a3734e045791173aca660efc7d7aeef78cebart#define __DRD_SEMAPHORE_H 318564292ac4b9adf51c45517cca2878732feb5bb4sewardj 328564292ac4b9adf51c45517cca2878732feb5bb4sewardj 338564292ac4b9adf51c45517cca2878732feb5bb4sewardj#include "drd_thread.h" // DrdThreadId 348564292ac4b9adf51c45517cca2878732feb5bb4sewardj#include "drd_vc.h" 358564292ac4b9adf51c45517cca2878732feb5bb4sewardj#include "pub_tool_basics.h" // Addr, SizeT 368564292ac4b9adf51c45517cca2878732feb5bb4sewardj 378564292ac4b9adf51c45517cca2878732feb5bb4sewardj 388564292ac4b9adf51c45517cca2878732feb5bb4sewardjstruct semaphore_info; 398564292ac4b9adf51c45517cca2878732feb5bb4sewardj 408564292ac4b9adf51c45517cca2878732feb5bb4sewardj 418564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_set_trace(const Bool trace_semaphore); 428564292ac4b9adf51c45517cca2878732feb5bb4sewardjstruct semaphore_info* semaphore_init(const Addr semaphore, const SizeT size, 438564292ac4b9adf51c45517cca2878732feb5bb4sewardj const Word pshared, const UWord value); 448564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_destroy(struct semaphore_info* const p); 458564292ac4b9adf51c45517cca2878732feb5bb4sewardjstruct semaphore_info* semaphore_get(const Addr semaphore); 4628230a3734e045791173aca660efc7d7aeef78cebartvoid semaphore_pre_wait(const Addr semaphore, const SizeT size); 478564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_post_wait(const DrdThreadId tid, const Addr semaphore, 4828230a3734e045791173aca660efc7d7aeef78cebart const Bool waited); 498564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_pre_post(const DrdThreadId tid, const Addr semaphore, 508564292ac4b9adf51c45517cca2878732feb5bb4sewardj const SizeT size); 518564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_post_post(const DrdThreadId tid, const Addr semaphore, 52e3b57aa6d61ab4a57ff8b7e23112f5cd20885795sewardj const SizeT size, const Bool waited); 538564292ac4b9adf51c45517cca2878732feb5bb4sewardjvoid semaphore_thread_delete(const DrdThreadId tid); 548564292ac4b9adf51c45517cca2878732feb5bb4sewardj 558564292ac4b9adf51c45517cca2878732feb5bb4sewardj 5628230a3734e045791173aca660efc7d7aeef78cebart#endif /* __DRD_SEMAPHORE_H */ 57