Changeset 8424 for trunk/Ohana/src/opihi/pcontrol/StackOps.c
- Timestamp:
- Aug 18, 2006, 1:44:51 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/StackOps.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/StackOps.c
r8296 r8424 25 25 ALLOCATE (stack[0].id, int, stack[0].NOBJECT); 26 26 27 // we need to use a mutex of type 28 // stack[0].mutex = PTHREAD_MUTEX_INITIALIZER;29 27 # ifdef THREADED 28 pthread_mutex_init (&stack[0].mutex, NULL); 29 # endif 30 30 return (stack); 31 31 } … … 72 72 void *PullStackByLocation (Stack *stack, int where) { 73 73 74 int i;75 74 void *object; 76 75 … … 96 95 void *PullStackByName (Stack *stack, char *name) { 97 96 98 int i , j;97 int i; 99 98 void *object; 100 99 … … 106 105 /* here is the element of interest */ 107 106 object = stack[0].object[i]; 108 RemoveStackEntry ( i);107 RemoveStackEntry (stack, i); 109 108 UnlockStack (stack); 110 109 return (object); … … 117 116 void *PullStackByID (Stack *stack, int id) { 118 117 119 int i , j;118 int i; 120 119 void *object; 121 120 … … 137 136 /* should only be called if you know where is a valid entry */ 138 137 int RemoveStackEntry (Stack *stack, int where) { 138 139 int i; 139 140 140 141 if (where < 0) abort(); … … 152 153 } 153 154 154 /* should only be called if manually lock the stack */155 intRemoveStackByID (Stack *stack, int id) {156 157 int i , j;155 /* should only be called if you manually lock the stack */ 156 void *RemoveStackByID (Stack *stack, int id) { 157 158 int i; 158 159 void *object; 159 160 … … 205 206 206 207 void LockStack (Stack *stack) { 208 # ifdef THREADED 209 pthread_mutex_lock (&stack[0].mutex); 210 # endif 207 211 return; 208 212 } 209 213 210 214 void UnlockStack (Stack *stack) { 215 # ifdef THREADED 216 pthread_mutex_unlock (&stack[0].mutex); 217 # endif 211 218 return; 212 219 } 213 214 // Safe with PTHREAD_MUTEX_INITIALIZER lock
Note:
See TracChangeset
for help on using the changeset viewer.
