Changeset 80649a91 in mainline for libc/generic/ipc.c


Ignore:
Timestamp:
2006-05-21T19:28:37Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a410beb
Parents:
1ee11f4
Message:

Merged libadt into libc.
Made lot of psthread and thread stuff thread-safe.
Added new driver framework for easy C connection programming.
Changed FB code to use new API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/ipc.c

    r1ee11f4 r80649a91  
    5858LIST_INITIALIZE(queued_calls);
    5959
    60 static atomic_t ipc_futex;
    61 
    62 void _ipc_init(void)
    63 {
    64         futex_initialize(&ipc_futex, 1);
    65 }
     60static atomic_t ipc_futex = FUTEX_INITIALIZER;
    6661
    6762int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
     
    253248
    254249
    255 /** Unconditionally wait for an IPC call.
     250/** One cycle of ipc wait for call call
    256251 *
    257252 * - dispatch ASYNC reoutines in the background
    258253 * @param call Space where the message is stored
     254 * @param usec Timeout in microseconds
     255 * @param flags Flags passed to SYS_IPC_WAIT (blocking, nonblocking)
    259256 * @return Callid of the answer.
    260257 */
    261 ipc_callid_t ipc_wait_for_call(ipc_call_t *call)
    262 {
    263         ipc_callid_t callid;
    264 
    265         do {
    266                 try_dispatch_queued_calls();
    267 
    268                 callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, SYNCH_NO_TIMEOUT, SYNCH_BLOCKING);
    269                 /* Handle received answers */
    270                 if (callid & IPC_CALLID_ANSWERED)
    271                         handle_answer(callid, call);
    272         } while (callid & IPC_CALLID_ANSWERED);
     258ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags)
     259{
     260        ipc_callid_t callid;
     261
     262        try_dispatch_queued_calls();
     263       
     264        callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags);
     265        /* Handle received answers */
     266        if (callid & IPC_CALLID_ANSWERED)
     267                handle_answer(callid, call);
    273268
    274269        return callid;
     
    287282
    288283        do {
    289                 try_dispatch_queued_calls();
    290 
    291                 callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, SYNCH_BLOCKING);
    292                 /* Handle received answers */
    293                 if (callid & IPC_CALLID_ANSWERED)
    294                         handle_answer(callid, call);
     284                callid = ipc_wait_cycle(call, usec, SYNCH_BLOCKING);
    295285        } while (callid & IPC_CALLID_ANSWERED);
    296286
     
    309299
    310300        do {
    311                 try_dispatch_queued_calls();
    312 
    313                 callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)call, SYNCH_NO_TIMEOUT, SYNCH_NON_BLOCKING);
    314                 /* Handle received answers */
    315                 if (callid & IPC_CALLID_ANSWERED)
    316                         handle_answer(callid, call);
     301                callid = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT, SYNCH_NON_BLOCKING);
    317302        } while (callid & IPC_CALLID_ANSWERED);
    318303
Note: See TracChangeset for help on using the changeset viewer.