Home
last modified time | relevance | path

Searched refs:thr (Results 1 – 13 of 13) sorted by relevance

/sys/kern/
Dthread.c98 Thread *thr = (Thread *)Slab_Alloc(&threadSlab); in Thread_Create() local
100 if (!thr) in Thread_Create()
103 memset(thr, 0, sizeof(*thr)); in Thread_Create()
107 thr->tid = proc->nextThreadID++; in Thread_Create()
108 thr->kstack = (uintptr_t)PAlloc_AllocPage(); in Thread_Create()
109 if (thr->kstack == 0) { in Thread_Create()
110 Slab_Free(&threadSlab, thr); in Thread_Create()
117 thr->proc = proc; in Thread_Create()
119 TAILQ_INSERT_TAIL(&proc->threadList, thr, threadList); in Thread_Create()
120 thr->space = proc->space; in Thread_Create()
[all …]
Dsched.c60 Thread *thr = curProc[CPU()]; in Sched_Current() local
61 Thread_Retain(thr); in Sched_Current()
65 return thr; in Sched_Current()
77 Sched_SetRunnable(Thread *thr) in Sched_SetRunnable() argument
81 if (thr->proc->procState == PROC_STATE_NULL) in Sched_SetRunnable()
82 thr->proc->procState = PROC_STATE_READY; in Sched_SetRunnable()
84 if (thr->schedState == SCHED_STATE_WAITING) { in Sched_SetRunnable()
85 thr->waitTime += KTime_GetEpochNS() - thr->waitStart; in Sched_SetRunnable()
86 thr->waitStart = 0; in Sched_SetRunnable()
87 TAILQ_REMOVE(&waitQueue, thr, schedQueue); in Sched_SetRunnable()
[all …]
Dwaitchannel.c73 Thread *thr = Sched_Current(); in WaitChannel_Sleep() local
75 Sched_SetWaiting(thr); in WaitChannel_Sleep()
76 TAILQ_INSERT_TAIL(&wchan->chanQueue, thr, chanQueue); in WaitChannel_Sleep()
93 Thread *thr; in WaitChannel_Wake() local
97 thr = TAILQ_FIRST(&wchan->chanQueue); in WaitChannel_Wake()
98 if (thr != NULL) { in WaitChannel_Wake()
99 TAILQ_REMOVE(&wchan->chanQueue, thr, chanQueue); in WaitChannel_Wake()
100 Sched_SetRunnable(thr); in WaitChannel_Wake()
101 Thread_Release(thr); in WaitChannel_Wake()
118 Thread *thr; in WaitChannel_WakeAll() local
[all …]
Dsemaphore.c74 Thread *thr; in Semaphore_Release() local
80 thr = TAILQ_FIRST(&sema->waiters); in Semaphore_Release()
81 if (thr != NULL) { in Semaphore_Release()
82 TAILQ_REMOVE(&sema->waiters, thr, semaQueue); in Semaphore_Release()
83 Sched_SetRunnable(thr); in Semaphore_Release()
111 Thread *thr; in Debug_Semaphores() local
113 TAILQ_FOREACH(thr, &sema->waiters, semaQueue) { in Debug_Semaphores()
114 kprintf("waiting: %d:%d\n", thr->proc->pid, thr->tid); in Debug_Semaphores()
Dloader.c131 Loader_Load(Thread *thr, VNode *vn, void *buf, uint64_t len) in Loader_Load() argument
136 AS *as = thr->space; in Loader_Load()
174 thr->proc->entrypoint = ehdr->e_entry; in Loader_Load()
205 Thread *thr = Sched_Current(); in Loader_LoadInit() local
209 Handle_Add(thr->proc, handle); in Loader_LoadInit()
211 Handle_Add(thr->proc, handle); in Loader_LoadInit()
213 Handle_Add(thr->proc, handle); in Loader_LoadInit()
218 Loader_Load(thr, initvn, pg, 1024); in Loader_LoadInit()
227 PMap_LoadAS(thr->space); // Reload CR3 in Loader_LoadInit()
247 tf.rip = thr->proc->entrypoint; in Loader_LoadInit()
Dprocess.c208 Thread *thr; in Process_Wait() local
229 thr = TAILQ_FIRST(&p->zombieQueue); in Process_Wait()
230 TAILQ_REMOVE(&p->zombieQueue, thr, schedQueue); in Process_Wait()
233 ASSERT(thr->proc->pid != 1); in Process_Wait()
234 Thread_Release(thr); in Process_Wait()
293 Thread *thr = curProc[CPU()]; in Debug_ProcInfo() local
296 Process_Dump(thr->proc); in Debug_ProcInfo()
Dsyscall.c76 Thread *thr; in Syscall_Spawn() local
138 thr = Thread_Create(proc); in Syscall_Spawn()
140 Log(syscall, "SPAWN %lx\n", thr); in Syscall_Spawn()
149 Loader_Load(thr, file, pg, 1024); in Syscall_Spawn()
152 Thread_SetupUThread(thr, proc->entrypoint, MEM_USERSPACE_STKTOP - PGSIZE); in Syscall_Spawn()
155 argstart = (char *)DMPA2VA(PMap_Translate(thr->space, MEM_USERSPACE_STKTOP - PGSIZE)); in Syscall_Spawn()
160 Sched_SetRunnable(thr); in Syscall_Spawn()
447 Thread *thr = (Thread *)arg; in ThreadWakeupHelper() local
449 Sched_SetRunnable(thr); in ThreadWakeupHelper()
450 KTimer_Release(thr->timerEvt); in ThreadWakeupHelper()
[all …]
/lib/libc/posix/
Dpthread.c56 struct pthread *thr = (struct pthread *)malloc(sizeof(*thr)); in __pthread_init() local
62 if (thr == NULL) { in __pthread_init()
66 thr->tid = OSGetTID(); in __pthread_init()
67 thr->error = 0; in __pthread_init()
68 thr->entry = NULL; in __pthread_init()
69 thr->arg = 0; in __pthread_init()
74 TAILQ_INSERT_HEAD(&__threads[thr->tid % THREAD_HASH_SLOTS], thr, threadTable); in __pthread_init()
82 struct pthread *thr; in pthread_self() local
85 TAILQ_FOREACH(thr, &__threads[tid % THREAD_HASH_SLOTS], threadTable) { in pthread_self()
86 if (thr->tid == tid) { in pthread_self()
[all …]
/sys/amd64/
Dthread.c20 Thread_InitArch(Thread *thr) in Thread_InitArch() argument
22 thr->arch.useFP = true; in Thread_InitArch()
26 Thread_SetupKThread(Thread *thr, void (*f)(), in Thread_SetupKThread() argument
30 uint64_t stacktop = thr->kstack + PGSIZE; in Thread_SetupKThread()
36 thr->arch.rsp = (uint64_t)sf; in Thread_SetupKThread()
75 Thread_SetupUThread(Thread *thr, uintptr_t rip, uintptr_t arg) in Thread_SetupUThread() argument
77 Thread_SetupKThread(thr, ThreadEnterUserLevelCB, rip, in Thread_SetupUThread()
78 thr->ustack, arg); in Thread_SetupUThread()
Dmachine.c232 Thread *thr = Thread_KThreadCreate(&Machine_IdleThread, NULL); in Machine_Init() local
233 if (thr == NULL) { in Machine_Init()
236 Sched_SetRunnable(thr); in Machine_Init()
/sys/include/
Dthread.h113 void Thread_Retain(Thread *thr);
114 void Thread_Release(Thread *thr);
115 uint64_t Thread_Wait(Thread *thr, uint64_t tid);
119 void Sched_SetRunnable(Thread *thr);
120 void Sched_SetWaiting(Thread *thr);
121 void Sched_SetZombie(Thread *thr);
126 void Thread_Dump(Thread *thr);
129 void Thread_InitArch(Thread *thr);
130 void Thread_SetupKThread(Thread *thr, void (*f)(),
132 void Thread_SetupUThread(Thread *thr, uint64_t rip, uint64_t arg);
Dloader.h8 bool Loader_Load(Thread *thr, VNode *vn, void *buf, uint64_t len);
/tests/
Dpthreadtest.c64 pthread_t thr; in main() local
71 status = pthread_create(&thr, NULL, thread_simple, NULL); in main()
73 status = pthread_join(thr, &result); in main()
80 status = pthread_create(&thr, NULL, thread_simple, (void *)1); in main()
82 status = pthread_join(thr, &result); in main()
102 status = pthread_create(&thr, NULL, thread_lock, (void *)1); in main()
111 status = pthread_join(thr, &result); in main()