Changes in / [f570cdf:0a981e3] in mainline


Ignore:
Location:
uspace/lib/c
Files:
3 edited

Legend:

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

    rf570cdf r0a981e3  
    16741674       
    16751675        ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3, arg4, msg,
    1676             reply_received);
     1676            reply_received, true);
    16771677       
    16781678        return (aid_t) msg;
     
    17121712       
    17131713        ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3, arg4, arg5,
    1714             msg, reply_received);
     1714            msg, reply_received, true);
    17151715       
    17161716        return (aid_t) msg;
     
    20012001{
    20022002        if (exch != NULL)
    2003                 ipc_call_async_0(exch->phone, imethod, NULL, NULL);
     2003                ipc_call_async_0(exch->phone, imethod, NULL, NULL, true);
    20042004}
    20052005
     
    20072007{
    20082008        if (exch != NULL)
    2009                 ipc_call_async_1(exch->phone, imethod, arg1, NULL, NULL);
     2009                ipc_call_async_1(exch->phone, imethod, arg1, NULL, NULL, true);
    20102010}
    20112011
     
    20142014{
    20152015        if (exch != NULL)
    2016                 ipc_call_async_2(exch->phone, imethod, arg1, arg2, NULL, NULL);
     2016                ipc_call_async_2(exch->phone, imethod, arg1, arg2, NULL, NULL,
     2017                    true);
    20172018}
    20182019
     
    20222023        if (exch != NULL)
    20232024                ipc_call_async_3(exch->phone, imethod, arg1, arg2, arg3, NULL,
    2024                     NULL);
     2025                    NULL, true);
    20252026}
    20262027
     
    20302031        if (exch != NULL)
    20312032                ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3, arg4,
    2032                     NULL, NULL);
     2033                    NULL, NULL, true);
    20332034}
    20342035
     
    20382039        if (exch != NULL)
    20392040                ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3, arg4,
    2040                     arg5, NULL, NULL);
     2041                    arg5, NULL, NULL, true);
    20412042}
    20422043
     
    21612162       
    21622163        ipc_call_async_0(exch->phone, IPC_M_CLONE_ESTABLISH, msg,
    2163             reply_received);
     2164            reply_received, true);
    21642165       
    21652166        sysarg_t rc;
     
    22102211       
    22112212        ipc_call_async_4(phone, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, arg4,
    2212             msg, reply_received);
     2213            msg, reply_received, true);
    22132214       
    22142215        sysarg_t rc;
  • uspace/lib/c/generic/ipc.c

    rf570cdf r0a981e3  
    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 *
    129132 */
    130133static inline void ipc_finish_async(ipc_callid_t callid, int phoneid,
    131     async_call_t *call)
     134    async_call_t *call, bool can_preempt)
    132135{
    133136        if (!call) {
     
    156159                list_append(&call->list, &queued_calls);
    157160               
    158                 call->fid = fibril_get_id();
    159                 fibril_switch(FIBRIL_TO_MANAGER);
    160                 /* Async futex unlocked by previous call */
     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                }
    161169               
    162170                return;
     
    189197 * @param private     Argument to be passed to the answer/error callback.
    190198 * @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 *
    191203 */
    192204void ipc_call_async_fast(int phoneid, sysarg_t imethod, sysarg_t arg1,
    193205    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private,
    194     ipc_async_callback_t callback)
     206    ipc_async_callback_t callback, bool can_preempt)
    195207{
    196208        async_call_t *call = NULL;
     
    234246        }
    235247       
    236         ipc_finish_async(callid, phoneid, call);
     248        ipc_finish_async(callid, phoneid, call, can_preempt);
    237249}
    238250
     
    254266 * @param private     Argument to be passed to the answer/error callback.
    255267 * @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 *
    256272 */
    257273void ipc_call_async_slow(int phoneid, sysarg_t imethod, sysarg_t arg1,
    258274    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private,
    259     ipc_async_callback_t callback)
     275    ipc_async_callback_t callback, bool can_preempt)
    260276{
    261277        async_call_t *call = ipc_prepare_async(private, callback);
     
    279295            ipc_call_async_internal(phoneid, &call->u.msg.data);
    280296       
    281         ipc_finish_async(callid, phoneid, call);
     297        ipc_finish_async(callid, phoneid, call, can_preempt);
    282298}
    283299
     
    359375                futex_up(&async_futex);
    360376               
    361                 assert(call->fid);
    362                 fibril_add_ready(call->fid);
     377                if (call->fid)
     378                        fibril_add_ready(call->fid);
    363379               
    364380                if (callid == (ipc_callid_t) IPC_CALLRET_FATAL) {
  • uspace/lib/c/include/ipc/ipc.h

    rf570cdf r0a981e3  
    8989 */
    9090
    91 #define ipc_call_async_0(phoneid, method, private, callback) \
     91#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
    9292        ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
    93             (callback))
    94 #define ipc_call_async_1(phoneid, method, arg1, private, callback) \
     93            (callback), (can_preempt))
     94#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
     95    can_preempt) \
    9596        ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
    96             (callback))
    97 #define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback) \
     97            (callback), (can_preempt))
     98#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
     99    can_preempt) \
    98100        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
    99             (private), (callback))
    100 #define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback) \
     101            (private), (callback), (can_preempt))
     102#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
     103    can_preempt) \
    101104        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
    102             (private), (callback))
     105            (private), (callback), (can_preempt))
    103106#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
    104     callback) \
     107    callback, can_preempt) \
    105108        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    106             (arg4), (private), (callback))
     109            (arg4), (private), (callback), (can_preempt))
    107110#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
    108     private, callback) \
     111    private, callback, can_preempt) \
    109112        ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    110             (arg4), (arg5), (private), (callback))
     113            (arg4), (arg5), (private), (callback), (can_preempt))
    111114
    112115extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    113     sysarg_t, void *, ipc_async_callback_t);
     116    sysarg_t, void *, ipc_async_callback_t, bool);
    114117extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    115     sysarg_t, sysarg_t, void *, ipc_async_callback_t);
     118    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    116119
    117120extern int ipc_hangup(int);
Note: See TracChangeset for help on using the changeset viewer.