Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/smp/semaphore.h need to be fixed.

0001 /*                    The Quest Operating System
0002  *  Copyright (C) 2005-2010  Richard West, Boston University
0003  *
0004  *  This program is free software: you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation, either version 3 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #ifndef _SEMAPHORE_H_
0019 #define _SEMAPHORE_H_
0020 #include "types.h"
0021 #include "smp/spinlock.h"
0022 
0023 struct _semaphore
0024 {
0025   int s, max;
0026   spinlock lock;
0027   u16 waitqueue;
0028 };
0029 typedef struct _semaphore semaphore;
0030 
0031 int semaphore_init (semaphore * sem, int max, int init);
0032 int semaphore_signal (semaphore * sem, int s);
0033 /* timeout: millisec, (-1) for indefinite */
0034 int semaphore_wait (semaphore * sem, int s, s16 timeout);
0035 int semaphore_destroy (semaphore * sem);
0036 
0037 #endif
0038 
0039 /*
0040  * Local Variables:
0041  * indent-tabs-mode: nil
0042  * mode: C
0043  * c-file-style: "gnu"
0044  * c-basic-offset: 2
0045  * End:
0046  */
0047 
0048 /* vi: set et sw=2 sts=2: */