Changeset 13964ef in mainline for kernel/generic/src/udebug/udebug.c


Ignore:
Timestamp:
2008-11-22T17:10:12Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0aa1665
Parents:
2eb893b
Message:

Fix race that allowed Udebug to report THREAD_B events for threads already reported with THREAD_READ.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/udebug/udebug.c

    r2eb893b r13964ef  
    306306}
    307307
    308 /** Thread-creation event hook.
     308/** Thread-creation event hook combined with attaching the thread.
    309309 *
    310310 * Must be called when a new userspace thread is created in the debugged
    311  * task. Generates a THREAD_B event.
     311 * task. Generates a THREAD_B event. Also attaches the thread @a t
     312 * to the task @a ta.
     313 *
     314 * This is necessary to avoid a race condition where the BEGIN and THREAD_READ
     315 * requests would be handled inbetween attaching the thread and checking it
     316 * for being in a debugging session to send the THREAD_B event. We could then
     317 * either miss threads or get some threads both in the thread list
     318 * and get a THREAD_B event for them.
    312319 *
    313320 * @param t     Structure of the thread being created. Not locked, as the
    314321 *              thread is not executing yet.
    315  */
    316 void udebug_thread_b_event(struct thread *t)
     322 * @param ta    Task to which the thread should be attached.
     323 */
     324void udebug_thread_b_event_attach(struct thread *t, struct task *ta)
    317325{
    318326        call_t *call;
     
    320328        mutex_lock(&TASK->udebug.lock);
    321329        mutex_lock(&THREAD->udebug.lock);
     330
     331        thread_attach(t, ta);
    322332
    323333        LOG("udebug_thread_b_event\n");
Note: See TracChangeset for help on using the changeset viewer.