Changeset 35509652 in mainline for libipc/generic/ipc.c
- Timestamp:
- 2006-05-16T11:05:18Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 450cd3a
- Parents:
- c2b43de
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libipc/generic/ipc.c
rc2b43de r35509652 34 34 #include <stdio.h> 35 35 #include <unistd.h> 36 #include <futex.h> 36 37 37 38 /** Structure used for keeping track of sent async msgs … … 56 57 LIST_INITIALIZE(queued_calls); 57 58 59 static atomic_t ipc_futex; 60 61 void _ipc_init(void) 62 { 63 futex_initialize(&ipc_futex, 1); 64 } 65 58 66 int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, 59 67 ipcarg_t *result) … … 138 146 IPC_SET_ARG1(call->u.msg.data, arg1); 139 147 IPC_SET_ARG2(call->u.msg.data, arg2); 140 148 149 futex_down(&ipc_futex); 141 150 list_append(&call->list, &queued_calls); 151 futex_up(&ipc_futex); 142 152 return; 143 153 } 144 154 call->u.callid = callid; 145 155 /* Add call to list of dispatched calls */ 156 futex_down(&ipc_futex); 146 157 list_append(&call->list, &dispatched_calls); 158 futex_up(&ipc_futex); 147 159 } 148 160 … … 185 197 ipc_callid_t callid; 186 198 199 futex_down(&ipc_futex); 187 200 while (!list_empty(&queued_calls)) { 188 201 call = list_get_instance(queued_calls.next, async_call_t, … … 194 207 break; 195 208 list_remove(&call->list); 209 196 210 if (callid == IPC_CALLRET_FATAL) { 211 futex_up(&ipc_futex); 197 212 call->callback(call->private, ENOENT, NULL); 198 213 free(call); 214 futex_down(&ipc_futex); 199 215 } else { 200 216 call->u.callid = callid; … … 202 218 } 203 219 } 220 futex_up(&ipc_futex); 204 221 } 205 222 … … 217 234 callid &= ~IPC_CALLID_ANSWERED; 218 235 236 futex_down(&ipc_futex); 219 237 for (item = dispatched_calls.next; item != &dispatched_calls; 220 238 item = item->next) { … … 222 240 if (call->u.callid == callid) { 223 241 list_remove(&call->list); 242 futex_up(&ipc_futex); 224 243 call->callback(call->private, 225 244 IPC_GET_RETVAL(*data), … … 228 247 } 229 248 } 249 futex_up(&ipc_futex); 230 250 printf("Received unidentified answer: %P!!!\n", callid); 231 251 } … … 302 322 } 303 323 324 325 /** Open shared memory connection over specified phoneid 326 * 327 * 328 * Allocates AS_area, notify the other side about our intention 329 * to open the connection 330 * 331 * @return Connection id identifying this connection 332 */ 333 //int ipc_dgr_open(int pohoneid, size_t bufsize) 334 //{ 335 /* Find new file descriptor in local descriptor table */ 336 /* Create AS_area, initialize structures */ 337 /* Send AS to other side, handle error states */ 338 339 //} 304 340 /* 305 int ipc_open_dgrconn(int pohoneid, size_t max_dgram) 306 { 307 308 } 309 341 void ipc_dgr_close(int cid) 342 { 343 } 344 345 void * ipc_dgr_alloc(int cid, size_t size) 346 { 347 } 348 349 void ipc_dgr_free(int cid, void *area) 350 { 351 352 } 353 354 int ipc_dgr_send(int cid, void *area) 355 { 356 } 357 358 359 int ipc_dgr_send_data(int cid, void *data, size_t size) 360 { 361 } 310 362 311 363 */
Note:
See TracChangeset
for help on using the changeset viewer.