Changeset 8a64e81e in mainline for kernel/generic/src


Ignore:
Timestamp:
2012-07-06T13:31:02Z (13 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d56712
Parents:
518dd43
Message:

workq: Add work queues: allow blocking work items, queuing items from interrupt handlers.

Location:
kernel/generic/src
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r518dd43 r8a64e81e  
    6868#include <sysinfo/sysinfo.h>
    6969#include <symtab.h>
     70#include <synch/workqueue.h>
    7071#include <errno.h>
    7172
     
    447448        .argc = 1,
    448449        .argv = &zone_argv
     450};
     451
     452/* Data and methods for the 'workq' command */
     453static int cmd_workq(cmd_arg_t *argv);
     454static cmd_info_t workq_info = {
     455        .name = "workq",
     456        .description = "Show global workq information.",
     457        .func = cmd_workq,
     458        .argc = 0
    449459};
    450460
     
    522532        &uptime_info,
    523533        &version_info,
     534        &workq_info,
    524535        &zones_info,
    525536        &zone_info,
     
    10151026}
    10161027
     1028/** Prints information about the global work queue.
     1029 *
     1030 * @param argv Ignores
     1031 *
     1032 * @return Always 1
     1033 */
     1034int cmd_workq(cmd_arg_t *argv)
     1035{
     1036        workq_global_print_info();
     1037        return 1;
     1038}
     1039
     1040
    10171041/** Command for listing memory zones
    10181042 *
  • kernel/generic/src/main/kinit.c

    r518dd43 r8a64e81e  
    7777#include <synch/waitq.h>
    7878#include <synch/spinlock.h>
     79#include <synch/workqueue.h>
    7980
    8081#define ALIVE_CHARS  4
     
    103104         */
    104105        thread_detach(THREAD);
    105        
     106
    106107        interrupts_disable();
     108       
     109        /*
     110         * Start processing work queue items. Some may have been queued during boot.
     111         */
     112        workq_global_worker_init();
    107113       
    108114#ifdef CONFIG_SMP
  • kernel/generic/src/main/main.c

    r518dd43 r8a64e81e  
    7575#include <synch/waitq.h>
    7676#include <synch/futex.h>
     77#include <synch/workqueue.h>
    7778#include <smp/smp_call.h>
    7879#include <arch/arch.h>
     
    249250
    250251        smp_call_init();
     252        workq_global_init();
    251253        clock_counter_init();
    252254        timeout_init();
  • kernel/generic/src/proc/scheduler.c

    r518dd43 r8a64e81e  
    5252#include <atomic.h>
    5353#include <synch/spinlock.h>
     54#include <synch/workqueue.h>
    5455#include <config.h>
    5556#include <context.h>
     
    126127static void after_thread_ran(void)
    127128{
     129        workq_after_thread_ran();
    128130        after_thread_ran_arch();
    129131}
  • kernel/generic/src/proc/thread.c

    r518dd43 r8a64e81e  
    4646#include <synch/spinlock.h>
    4747#include <synch/waitq.h>
     48#include <synch/workqueue.h>
    4849#include <cpu.h>
    4950#include <str.h>
     
    260261}
    261262
     263/** Invoked right before thread_ready() readies the thread. thread is locked. */
     264static void before_thread_is_ready(thread_t *thread)
     265{
     266        ASSERT(irq_spinlock_locked(&thread->lock));
     267        workq_before_thread_is_ready(thread);
     268}
     269
    262270/** Make thread ready
    263271 *
     
    273281        ASSERT(thread->state != Ready);
    274282
     283        before_thread_is_ready(thread);
     284       
    275285        int i = (thread->priority < RQ_COUNT - 1) ?
    276286            ++thread->priority : thread->priority;
     
    378388       
    379389        thread->task = task;
     390       
     391        thread->workq = NULL;
    380392       
    381393        thread->fpu_context_exists = false;
Note: See TracChangeset for help on using the changeset viewer.