/home/dko/projects/mobilec/tags/MobileC-v1.10.2/MobileC-v1.10.2/src/include/barrier.h

Go to the documentation of this file.
00001 /* SVN FILE INFO
00002  * $Revision: 207 $ : Last Committed Revision
00003  * $Date: 2008-07-11 17:55:19 -0700 (Fri, 11 Jul 2008) $ : Last Committed Date */
00004 /*[
00005  * Copyright (c) 2007 Integration Engineering Laboratory
00006                       University of California, Davis
00007  *
00008  * Permission to use, copy, and distribute this software and its
00009  * documentation for any purpose with or without fee is hereby granted,
00010  * provided that the above copyright notice appear in all copies and
00011  * that both that copyright notice and this permission notice appear
00012  * in supporting documentation.
00013  *
00014  * Permission to modify the software is granted, but not the right to
00015  * distribute the complete modified source code.  Modifications are to
00016  * be distributed as patches to the released version.  Permission to
00017  * distribute binaries produced by compiling modified sources is granted,
00018  * provided you
00019  *   1. distribute the corresponding source modifications from the
00020  *    released version in the form of a patch file along with the binaries,
00021  *   2. add special version identification to distinguish your version
00022  *    in addition to the base release version number,
00023  *   3. provide your name and address as the primary contact for the
00024  *    support of your modified version, and
00025  *   4. retain our contact information in regard to use of the base
00026  *    software.
00027  * Permission to distribute the released version of the source code along
00028  * with corresponding source modifications in the form of a patch file is
00029  * granted with same provisions 2 through 4 for binary distributions.
00030  *
00031  * This software is provided "as is" without express or implied warranty
00032  * to the extent permitted by applicable law.
00033 ]*/
00034 
00035 #ifndef _BARRIER_H_
00036 #define _BARRIER_H_
00037 
00038 #include"macros.h"
00039 #include"../mc_list/list.h"
00040 #include"mc_rwlock.h"
00041 
00042 typedef struct barrier_node_s {
00043     MUTEX_T* lock;
00044     COND_T* cond;
00045     int id;
00046     int num_registered;
00047     int num_waiting;
00048 } barrier_node_t;
00049 typedef barrier_node_t* barrier_node_p;
00050 
00051 typedef struct barrier_queue_s {
00052     RWLOCK_T* lock;
00053     
00054     list_p list;
00055     int size;
00056 } barrier_queue_t;
00057 typedef barrier_queue_t* barrier_queue_p;
00058 
00059 /* Node Funcs */
00060 
00061 barrier_node_p
00062 barrier_node_Initialize(int id, int num_registered);
00063 
00064 int 
00065 barrier_node_Destroy(barrier_node_p node);
00066 
00067 /* List Funcs */
00068 
00069 int 
00070 barrier_queue_Add(barrier_queue_p list, barrier_node_p node);
00071 
00072 int 
00073 barrier_queue_Delete(int id, barrier_queue_p list);
00074 
00075 int barrier_queue_Destroy(barrier_queue_p queue);
00076 
00077 barrier_node_p
00078 barrier_queue_Get(barrier_queue_p list, int id);
00079 
00080 barrier_queue_p 
00081 barrier_queue_New(void);
00082 
00083 barrier_node_p
00084 barrier_queue_Pop(barrier_queue_p queue);
00085 #endif

Generated on Fri Jul 11 17:59:44 2008 for Mobile-C by  doxygen 1.5.4