Nut/OS  4.10.3
API Reference
condition.h
Go to the documentation of this file.
00001 #ifndef _SYS_CONDITION_H_
00002 #define _SYS_CONDITION_H_
00003 
00004 /*
00005  * Copyright (C) 2008 by EmbeddedIT,
00006  * Ole Reinhardt <ole.reinhardt@embedded-it.de> All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in the
00016  *    documentation and/or other materials provided with the distribution.
00017  * 3. Neither the name of the copyright holders nor the names of
00018  *    contributors may be used to endorse or promote products derived
00019  *    from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY EMBEDDED IT AND CONTRIBUTORS
00022  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EMBEDDED IT
00025  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00027  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00028  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00029  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00030  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00031  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  *
00035  */
00036 
00037 /*
00038  * $Log$
00039  * Revision 1.2  2008/04/29 01:51:52  thiagocorrea
00040  * Compile fix
00041  *
00042  * Revision 1.1  2008/04/21 22:24:53  olereinhardt
00043  * Implemented condition variables to use with NutOS as an application candy
00044  *
00045  */
00046 
00047 #include <sys/atom.h>
00048 #include <sys/mutex.h>
00049 #include <sys/types.h>
00050 
00055 
00059 typedef struct _CONDITION CONDITION;
00060 
00066 struct _CONDITION {
00067     HANDLE event; 
00068     MUTEX  mutex; 
00069 };
00070 
00071 
00072 __BEGIN_DECLS
00073 
00074 extern int NutConditionInit(CONDITION * cond);
00075 extern void NutConditionLock(CONDITION * cond);
00076 extern void NutConditionUnlock(CONDITION * cond);
00077 extern int NutConditionWait(CONDITION * cond);
00078 extern int NutConditionSignal(CONDITION * cond);
00079 extern int NutConditionBroadcast(CONDITION * cond);
00080 extern void NutConditionFree(CONDITION * cond);
00081 
00082 __END_DECLS
00083 
00086 #endif