Changeset a33f0a6 in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2011-08-03T17:34:57Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1940326
Parents:
52a79081 (diff), 3fab770 (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 from mainline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r52a79081 ra33f0a6  
    5555#include <time/clock.h>
    5656#include <time/timeout.h>
     57#include <time/delay.h>
    5758#include <config.h>
    5859#include <arch/interrupt.h>
     
    6768#include <syscall/copy.h>
    6869#include <errno.h>
    69 
    70 
    71 #ifndef LOADED_PROG_STACK_PAGES_NO
    72 #define LOADED_PROG_STACK_PAGES_NO 1
    73 #endif
    74 
    7570
    7671/** Thread states */
     
    265260         */
    266261       
    267         list_append(&thread->rq_link, &cpu->rq[i].rq_head);
     262        list_append(&thread->rq_link, &cpu->rq[i].rq);
    268263        cpu->rq[i].n++;
    269264        irq_spinlock_unlock(&(cpu->rq[i].lock), true);
     
    300295       
    301296        /* Not needed, but good for debugging */
    302         memsetb(thread->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);
     297        memsetb(thread->kstack, STACK_SIZE, 0);
    303298       
    304299        irq_spinlock_lock(&tidlock, true);
     
    308303        context_save(&thread->saved_context);
    309304        context_set(&thread->saved_context, FADDR(cushion),
    310             (uintptr_t) thread->kstack, THREAD_STACK_SIZE);
     305            (uintptr_t) thread->kstack, STACK_SIZE);
    311306       
    312307        the_initialize((the_t *) thread->kstack);
     
    327322        thread->cpu = NULL;
    328323        thread->flags = flags;
     324        thread->nomigrate = 0;
    329325        thread->state = Entering;
    330326       
     
    427423                atomic_inc(&task->lifecount);
    428424       
    429         list_append(&thread->th_link, &task->th_head);
     425        list_append(&thread->th_link, &task->threads);
    430426       
    431427        irq_spinlock_pass(&task->lock, &threads_lock);
     
    489485}
    490486
     487/** Prevent the current thread from being migrated to another processor. */
     488void thread_migration_disable(void)
     489{
     490        ASSERT(THREAD);
     491
     492        THREAD->nomigrate++;
     493}
     494
     495/** Allow the current thread to be migrated to another processor. */
     496void thread_migration_enable(void)
     497{
     498        ASSERT(THREAD);
     499        ASSERT(THREAD->nomigrate > 0);
     500
     501        THREAD->nomigrate--;
     502}
     503
    491504/** Thread sleep
    492505 *
     
    605618                printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n",
    606619                    thread->tid, name, thread, thread_states[thread->state],
    607                     thread->task, thread->task->context);
     620                    thread->task, thread->task->container);
    608621#endif
    609622       
     
    617630                printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n",
    618631                    thread->tid, name, thread, thread_states[thread->state],
    619                     thread->task, thread->task->context);
     632                    thread->task, thread->task->container);
    620633#endif
    621634       
     
    658671        else
    659672                printf("[id    ] [name        ] [address ] [state ] [task    ]"
    660                     " [ctx]\n");
     673                    " [ctn]\n");
    661674#endif
    662675       
     
    667680        } else
    668681                printf("[id    ] [name        ] [address         ] [state ]"
    669                     " [task            ] [ctx]\n");
     682                    " [task            ] [ctn]\n");
    670683#endif
    671684       
     
    918931}
    919932
     933sysarg_t sys_thread_udelay(uint32_t usec)
     934{
     935        delay(usec);
     936        return 0;
     937}
     938
    920939/** @}
    921940 */
Note: See TracChangeset for help on using the changeset viewer.