Changeset 780c8ce in mainline


Ignore:
Timestamp:
2019-08-07T05:52:27Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
012dd8e
Parents:
2aaccd3
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-10-22 23:09:22)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 05:52:27)
Message:

taskman: Light streamlining (removing TODOs)

  • Low work attitude today :-(
Location:
uspace/srv/taskman
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/taskman/event.c

    r2aaccd3 r780c8ce  
    189189}
    190190
    191 void wait_for_task(task_id_t id, int flags, ipc_callid_t callid, ipc_call_t *call)
     191void wait_for_task(task_id_t id, int flags, ipc_callid_t callid,
     192     task_id_t waiter_id)
    192193{
    193194        assert(!(flags & TASK_WAIT_BOTH) ||
     
    214215         * wait.
    215216         */
    216         task_id_t waiter_id = call->in_task_id;
    217217        fibril_rwlock_write_lock(&pending_wait_lock);
    218218        pending_wait_t *pr = NULL;
     
    264264
    265265
    266 int task_set_retval(ipc_call_t *call)
     266int task_set_retval(task_id_t sender, int retval, bool wait_for_exit)
    267267{
    268268        int rc = EOK;
    269         task_id_t id = call->in_task_id;
    270269       
    271270        fibril_rwlock_write_lock(&task_hash_table_lock);
    272         task_t *t = task_get_by_id(id);
     271        task_t *t = task_get_by_id(sender);
    273272
    274273        if ((t == NULL) || (t->exit != TASK_EXIT_RUNNING)) {
     
    277276        }
    278277       
    279         t->retval = IPC_GET_ARG1(*call);
    280         t->retval_type = IPC_GET_ARG2(*call) ? RVAL_SET_EXIT : RVAL_SET;
     278        t->retval = retval;
     279        t->retval_type = wait_for_exit ? RVAL_SET_EXIT : RVAL_SET;
    281280       
    282281        event_notify(t);
  • uspace/srv/taskman/event.h

    r2aaccd3 r780c8ce  
    4141extern int event_init(void);
    4242
    43 
    44 // TODO unify this API for all call/connection handlers
    4543extern int event_register_listener(task_id_t, async_sess_t *);
    46 extern void wait_for_task(task_id_t, int, ipc_callid_t, ipc_call_t *);
    47 extern int task_set_retval(ipc_call_t *);
     44extern void wait_for_task(task_id_t, int, ipc_callid_t, task_id_t);
     45extern int task_set_retval(task_id_t, int, bool);
    4846
    4947extern void task_terminated(task_id_t, exit_reason_t);
  • uspace/srv/taskman/main.c

    r2aaccd3 r780c8ce  
    2727 */
    2828
     29/**
     30 * Locking order:
     31 * - task_hash_table_lock (task.c),
     32 * - pending_wait_lock (event.c),
     33 * - listeners_lock (event.c).
     34 *
     35 * @addtogroup taskman
     36 * @{
     37 */
     38
    2939#include <adt/prodcons.h>
    3040#include <assert.h>
     
    113123            MERGE_LOUP32(IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall));
    114124        int flags = IPC_GET_ARG3(*icall);
    115 
    116         wait_for_task(id, flags, iid, icall);
     125        task_id_t waiter_id = icall->in_task_id;
     126
     127        wait_for_task(id, flags, iid, waiter_id);
    117128}
    118129
     
    120131{
    121132        printf("%s:%i from %llu\n", __func__, __LINE__, icall->in_task_id);
    122         int rc = task_set_retval(icall);
     133        task_id_t sender = icall->in_task_id;
     134        int retval = IPC_GET_ARG1(*icall);
     135        bool wait_for_exit = IPC_GET_ARG2(*icall);
     136
     137        int rc = task_set_retval(sender, retval, wait_for_exit);
    123138        async_answer_0(iid, rc);
    124139}
     
    265280}
    266281
    267 /** Build hard coded configuration */
    268 
    269282
    270283int main(int argc, char *argv[])
     
    313326        return 0;
    314327}
     328
     329/**
     330 * @}
     331 */
  • uspace/srv/taskman/task.c

    r2aaccd3 r780c8ce  
    2727 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    2828 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29  */
    30 
    31 /**
    32  * locking order: (TODO move to main?)
    33  * - task_hash_table_lock,
    34  * - pending_wait_lock.
    35  * - listeners_lock
    36  *
    37  * @addtogroup taskman
    38  * @{
    3929 */
    4030
Note: See TracChangeset for help on using the changeset viewer.