Changeset dcc150cb in mainline


Ignore:
Timestamp:
2016-05-23T11:18:33Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f570cdf
Parents:
f6017ee
Message:

Fibrils can always be preempted during IPC

Location:
uspace/lib/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    rf6017ee rdcc150cb  
    16741674       
    16751675        ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3, arg4, msg,
    1676             reply_received, true);
     1676            reply_received);
    16771677       
    16781678        return (aid_t) msg;
     
    17121712       
    17131713        ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3, arg4, arg5,
    1714             msg, reply_received, true);
     1714            msg, reply_received);
    17151715       
    17161716        return (aid_t) msg;
     
    20012001{
    20022002        if (exch != NULL)
    2003                 ipc_call_async_0(exch->phone, imethod, NULL, NULL, true);
     2003                ipc_call_async_0(exch->phone, imethod, NULL, NULL);
    20042004}
    20052005
     
    20072007{
    20082008        if (exch != NULL)
    2009                 ipc_call_async_1(exch->phone, imethod, arg1, NULL, NULL, true);
     2009                ipc_call_async_1(exch->phone, imethod, arg1, NULL, NULL);
    20102010}
    20112011
     
    20142014{
    20152015        if (exch != NULL)
    2016                 ipc_call_async_2(exch->phone, imethod, arg1, arg2, NULL, NULL,
    2017                     true);
     2016                ipc_call_async_2(exch->phone, imethod, arg1, arg2, NULL, NULL);
    20182017}
    20192018
     
    20232022        if (exch != NULL)
    20242023                ipc_call_async_3(exch->phone, imethod, arg1, arg2, arg3, NULL,
    2025                     NULL, true);
     2024                    NULL);
    20262025}
    20272026
     
    20312030        if (exch != NULL)
    20322031                ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3, arg4,
    2033                     NULL, NULL, true);
     2032                    NULL, NULL);
    20342033}
    20352034
     
    20392038        if (exch != NULL)
    20402039                ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3, arg4,
    2041                     arg5, NULL, NULL, true);
     2040                    arg5, NULL, NULL);
    20422041}
    20432042
     
    21622161       
    21632162        ipc_call_async_0(exch->phone, IPC_M_CLONE_ESTABLISH, msg,
    2164             reply_received, true);
     2163            reply_received);
    21652164       
    21662165        sysarg_t rc;
     
    22112210       
    22122211        ipc_call_async_4(phone, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, arg4,
    2213             msg, reply_received, true);
     2212            msg, reply_received);
    22142213       
    22152214        sysarg_t rc;
  • uspace/lib/c/generic/ipc.c

    rf6017ee rdcc150cb  
    127127 * @param phoneid     Phone handle through which the call was made.
    128128 * @param call        Structure returned by ipc_prepare_async().
    129  * @param can_preempt If true, the current fibril can be preempted
    130  *                    in this call.
    131  *
    132129 */
    133130static inline void ipc_finish_async(ipc_callid_t callid, int phoneid,
    134     async_call_t *call, bool can_preempt)
     131    async_call_t *call)
    135132{
    136133        if (!call) {
     
    159156                list_append(&call->list, &queued_calls);
    160157               
    161                 if (can_preempt) {
    162                         call->fid = fibril_get_id();
    163                         fibril_switch(FIBRIL_TO_MANAGER);
    164                         /* Async futex unlocked by previous call */
    165                 } else {
    166                         call->fid = 0;
    167                         futex_up(&async_futex);
    168                 }
     158                call->fid = fibril_get_id();
     159                fibril_switch(FIBRIL_TO_MANAGER);
     160                /* Async futex unlocked by previous call */
    169161               
    170162                return;
     
    197189 * @param private     Argument to be passed to the answer/error callback.
    198190 * @param callback    Answer or error callback.
    199  * @param can_preempt If true, the current fibril will be preempted in
    200  *                    case the kernel temporarily refuses to accept more
    201  *                    asynchronous calls.
    202  *
    203191 */
    204192void ipc_call_async_fast(int phoneid, sysarg_t imethod, sysarg_t arg1,
    205193    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private,
    206     ipc_async_callback_t callback, bool can_preempt)
     194    ipc_async_callback_t callback)
    207195{
    208196        async_call_t *call = NULL;
     
    246234        }
    247235       
    248         ipc_finish_async(callid, phoneid, call, can_preempt);
     236        ipc_finish_async(callid, phoneid, call);
    249237}
    250238
     
    266254 * @param private     Argument to be passed to the answer/error callback.
    267255 * @param callback    Answer or error callback.
    268  * @param can_preempt If true, the current fibril will be preempted in
    269  *                    case the kernel temporarily refuses to accept more
    270  *                    asynchronous calls.
    271  *
    272256 */
    273257void ipc_call_async_slow(int phoneid, sysarg_t imethod, sysarg_t arg1,
    274258    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private,
    275     ipc_async_callback_t callback, bool can_preempt)
     259    ipc_async_callback_t callback)
    276260{
    277261        async_call_t *call = ipc_prepare_async(private, callback);
     
    295279            ipc_call_async_internal(phoneid, &call->u.msg.data);
    296280       
    297         ipc_finish_async(callid, phoneid, call, can_preempt);
     281        ipc_finish_async(callid, phoneid, call);
    298282}
    299283
     
    375359                futex_up(&async_futex);
    376360               
    377                 if (call->fid)
    378                         fibril_add_ready(call->fid);
     361                assert(call->fid);
     362                fibril_add_ready(call->fid);
    379363               
    380364                if (callid == (ipc_callid_t) IPC_CALLRET_FATAL) {
  • uspace/lib/c/include/ipc/ipc.h

    rf6017ee rdcc150cb  
    8989 */
    9090
    91 #define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
     91#define ipc_call_async_0(phoneid, method, private, callback) \
    9292        ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
    93             (callback), (can_preempt))
    94 #define ipc_call_async_1(phoneid, method, arg1, private, callback, \
    95     can_preempt) \
     93            (callback))
     94#define ipc_call_async_1(phoneid, method, arg1, private, callback) \
    9695        ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
    97             (callback), (can_preempt))
    98 #define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
    99     can_preempt) \
     96            (callback))
     97#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback) \
    10098        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
    101             (private), (callback), (can_preempt))
    102 #define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
    103     can_preempt) \
     99            (private), (callback))
     100#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback) \
    104101        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
    105             (private), (callback), (can_preempt))
     102            (private), (callback))
    106103#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
    107     callback, can_preempt) \
     104    callback) \
    108105        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    109             (arg4), (private), (callback), (can_preempt))
     106            (arg4), (private), (callback))
    110107#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
    111     private, callback, can_preempt) \
     108    private, callback) \
    112109        ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    113             (arg4), (arg5), (private), (callback), (can_preempt))
     110            (arg4), (arg5), (private), (callback))
    114111
    115112extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    116     sysarg_t, void *, ipc_async_callback_t, bool);
     113    sysarg_t, void *, ipc_async_callback_t);
    117114extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    118     sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
     115    sysarg_t, sysarg_t, void *, ipc_async_callback_t);
    119116
    120117extern int ipc_hangup(int);
Note: See TracChangeset for help on using the changeset viewer.