Changeset bc7d44c in mainline for kernel


Ignore:
Timestamp:
2009-08-21T07:33:36Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
af8e565
Parents:
b9c7425 (diff), 207e208e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge fibril synchronization improvements.

Location:
kernel/generic
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/sysipc.h

    rb9c7425 rbc7d44c  
    5252unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    5353    int nonblocking);
     54unative_t sys_ipc_poke(void);
    5455unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
    5556    unative_t method, unative_t arg1, unative_t arg2, int mode);
  • kernel/generic/include/synch/waitq.h

    rb9c7425 rbc7d44c  
    6868struct thread;
    6969
    70 extern void waitq_initialize(waitq_t *wq);
    71 extern int waitq_sleep_timeout(waitq_t *wq, uint32_t usec, int flags);
    72 extern ipl_t waitq_sleep_prepare(waitq_t *wq);
    73 extern int waitq_sleep_timeout_unsafe(waitq_t *wq, uint32_t usec, int flags);
    74 extern void waitq_sleep_finish(waitq_t *wq, int rc, ipl_t ipl);
    75 extern void waitq_wakeup(waitq_t *wq, wakeup_mode_t mode);
    76 extern void _waitq_wakeup_unsafe(waitq_t *wq, wakeup_mode_t mode);
    77 extern void waitq_interrupt_sleep(struct thread *t);
     70extern void waitq_initialize(waitq_t *);
     71extern int waitq_sleep_timeout(waitq_t *, uint32_t, int);
     72extern ipl_t waitq_sleep_prepare(waitq_t *);
     73extern int waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, int);
     74extern void waitq_sleep_finish(waitq_t *, int, ipl_t);
     75extern void waitq_wakeup(waitq_t *, wakeup_mode_t);
     76extern void _waitq_wakeup_unsafe(waitq_t *, wakeup_mode_t);
     77extern void waitq_interrupt_sleep(struct thread *);
     78extern void waitq_unsleep(waitq_t *);
    7879
    7980#endif
  • kernel/generic/include/syscall/syscall.h

    rb9c7425 rbc7d44c  
    6666        SYS_IPC_FORWARD_SLOW,
    6767        SYS_IPC_WAIT,
     68        SYS_IPC_POKE,
    6869        SYS_IPC_HANGUP,
    6970        SYS_IPC_REGISTER_IRQ,
  • kernel/generic/src/ipc/sysipc.c

    rb9c7425 rbc7d44c  
    4444#include <ipc/ipcrsc.h>
    4545#include <ipc/kbox.h>
     46#include <synch/waitq.h>
    4647#include <udebug/udebug_ipc.h>
    4748#include <arch/interrupt.h>
     
    10511052}
    10521053
     1054/** Interrupt one thread from sys_ipc_wait_for_call(). */
     1055unative_t sys_ipc_poke(void)
     1056{
     1057        waitq_unsleep(&TASK->answerbox.wq);     
     1058        return EOK;
     1059}
     1060
    10531061/** Connect an IRQ handler to a task.
    10541062 *
  • kernel/generic/src/synch/waitq.c

    rb9c7425 rbc7d44c  
    171171out:
    172172        spinlock_unlock(&threads_lock);
     173        interrupts_restore(ipl);
     174}
     175
     176/** Interrupt the first thread sleeping in the wait queue.
     177 *
     178 * Note that the caller somehow needs to know that the thread to be interrupted
     179 * is sleeping interruptibly.
     180 *
     181 * @param wq            Pointer to wait queue.
     182 */
     183void waitq_unsleep(waitq_t *wq)
     184{
     185        ipl_t ipl;
     186
     187        ipl = interrupts_disable();
     188        spinlock_lock(&wq->lock);
     189
     190        if (!list_empty(&wq->head)) {
     191                thread_t *t;
     192               
     193                t = list_get_instance(wq->head.next, thread_t, wq_link);
     194                spinlock_lock(&t->lock);
     195                ASSERT(t->sleep_interruptible);
     196                if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))
     197                        t->timeout_pending = false;
     198                list_remove(&t->wq_link);
     199                t->saved_context = t->sleep_interruption_context;
     200                t->sleep_queue = NULL;
     201                spinlock_unlock(&t->lock);
     202                thread_ready(t);
     203        }
     204
     205        spinlock_unlock(&wq->lock);
    173206        interrupts_restore(ipl);
    174207}
  • kernel/generic/src/syscall/syscall.c

    rb9c7425 rbc7d44c  
    137137        (syshandler_t) sys_ipc_forward_slow,
    138138        (syshandler_t) sys_ipc_wait_for_call,
     139        (syshandler_t) sys_ipc_poke,
    139140        (syshandler_t) sys_ipc_hangup,
    140141        (syshandler_t) sys_ipc_register_irq,
Note: See TracChangeset for help on using the changeset viewer.