Mercurial > flash_v2
annotate packages/kernel/current/src/sync/mbox.cxx @ 66:bf00f99aec69 ecos-sw-2000-02-02
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
| author | jlarmour |
|---|---|
| date | Wed, 02 Feb 2000 19:57:02 +0000 |
| parents | c38311975d4f |
| children | e0c0827131d1 |
| rev | line source |
|---|---|
| 0 | 1 //========================================================================== |
| 2 // | |
| 2 | 3 // mbox.cxx |
| 0 | 4 // |
| 2 | 5 // Mbox mbox template class implementation |
| 0 | 6 // |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
12 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
14 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
15 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // |
| 0 | 30 //####COPYRIGHTEND#### |
| 31 //========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 2 | 34 // Author(s): hmt |
| 35 // Contributors: hmt | |
| 36 // Date: 1998-02-11 | |
| 37 // Purpose: Mbox implementation | |
| 38 // Description: This file contains the implementations of the mbox class | |
| 0 | 39 // |
| 40 //####DESCRIPTIONEND#### | |
| 41 // | |
| 42 //========================================================================== | |
| 43 | |
| 44 #include <pkgconf/kernel.h> | |
| 45 | |
| 46 #include <cyg/kernel/ktypes.h> // base kernel types | |
| 47 #include <cyg/infra/cyg_trac.h> // tracing macros | |
| 48 #include <cyg/infra/cyg_ass.h> // assertion macros | |
| 49 #include <cyg/kernel/instrmnt.h> // instrumentation | |
| 50 | |
| 51 #include <cyg/kernel/thread.inl> // Cyg_Thread inlines | |
| 52 | |
| 53 #include <cyg/kernel/mbox.hxx> // our own header | |
| 54 | |
| 55 #ifndef CYGIMP_MBOXT_INLINE // force inlining | |
| 56 #define CYGIMP_MBOXT_INLINE // of implementation | |
| 57 #endif | |
| 58 | |
| 59 #ifdef CYGIMP_MBOX_USE_MBOXT_PLAIN | |
| 60 #include <cyg/kernel/mboxt.inl> // mbox template implementation | |
| 61 #else | |
| 62 #include <cyg/kernel/mboxt2.inl> // mbox template implementation | |
| 63 #endif | |
| 64 | |
| 65 // ------------------------------------------------------------------------- | |
| 66 // This module exists to cause exactly one instance of these functions to | |
| 67 // exist; this is just like a vanilla class, except we use the template | |
| 68 // class to acquire an implementation. The template functions are inlined | |
| 69 // in each of these methods. | |
| 70 | |
| 71 | |
| 72 // ------------------------------------------------------------------------- | |
| 73 // Constructor | |
| 74 | |
| 75 Cyg_Mbox::Cyg_Mbox() | |
| 76 { | |
| 77 } | |
| 78 | |
| 79 // ------------------------------------------------------------------------- | |
| 80 // Destructor | |
| 81 | |
| 82 Cyg_Mbox::~Cyg_Mbox() | |
| 83 { | |
| 84 } | |
| 85 | |
| 86 // ------------------------------------------------------------------------- | |
| 87 // debugging/assert function | |
| 88 | |
| 89 #ifdef CYGDBG_USE_ASSERTS | |
| 90 cyg_bool | |
| 2 | 91 Cyg_Mbox::check_this(cyg_assert_class_zeal zeal) const |
| 0 | 92 { |
| 93 return m.check_this(zeal); | |
| 94 } | |
| 95 #endif | |
| 96 | |
| 97 // ------------------------------------------------------------------------- | |
| 98 // now the members themselves: | |
| 99 | |
| 100 void * | |
| 101 Cyg_Mbox::get() | |
| 102 { | |
| 103 void * p; | |
| 104 if ( ! m.get( p ) ) | |
| 105 return NULL; | |
| 106 return p; | |
| 107 } | |
| 108 | |
| 109 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 110 void * | |
| 111 Cyg_Mbox::get( cyg_tick_count timeout ) | |
| 112 { | |
| 113 void * p; | |
| 114 if ( ! m.get( p, timeout ) ) | |
| 115 return NULL; | |
| 116 return p; | |
| 117 } | |
| 118 #endif | |
| 119 | |
| 120 void * | |
| 121 Cyg_Mbox::tryget() | |
| 122 { | |
| 123 void * p; | |
| 124 if ( ! m.tryget( p ) ) | |
| 125 return NULL; | |
| 126 return p; | |
| 127 } | |
| 128 | |
| 2 | 129 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 130 cyg_bool |
| 131 Cyg_Mbox::put( void *item ) | |
| 132 { | |
| 133 return m.put( item ); | |
| 134 } | |
| 135 | |
| 136 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 137 cyg_bool | |
| 138 Cyg_Mbox::put( void *item, cyg_tick_count timeout ) | |
| 139 { | |
| 140 return m.put( item, timeout ); | |
| 141 } | |
| 142 #endif | |
| 143 #endif // CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 144 | |
| 145 cyg_bool | |
| 146 Cyg_Mbox::tryput( void *item ) | |
| 147 { | |
| 148 return m.tryput( item ); | |
| 149 } | |
| 150 | |
| 151 void * | |
| 152 Cyg_Mbox::peek_item() // Get next item to be returned | |
| 153 { | |
| 154 void *p; | |
| 155 if ( ! m.peek_item( p ) ) | |
| 156 return NULL; | |
| 157 return p; | |
| 158 } | |
| 159 | |
| 160 // ------------------------------------------------------------------------- | |
| 161 // EOF mbox.cxx |
