kern_thread.c (e01eafef2acf905825e334a042ab21e1e894cf44) kern_thread.c (0c3967e7febd9b1c9cbbe632214ed2cc0c30dae7)
1/*-
2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 311 unchanged lines hidden (view full) ---

320 thread_reap(); /* check if any zombies to get */
321
322 td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK);
323 KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack"));
324 if (!vm_thread_new(td, 0)) {
325 uma_zfree(thread_zone, td);
326 return (NULL);
327 }
1/*-
2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 311 unchanged lines hidden (view full) ---

320 thread_reap(); /* check if any zombies to get */
321
322 td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK);
323 KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack"));
324 if (!vm_thread_new(td, 0)) {
325 uma_zfree(thread_zone, td);
326 return (NULL);
327 }
328 cpu_thread_setup(td);
328 cpu_thread_alloc(td);
329 return (td);
330}
331
332
333/*
334 * Deallocate a thread.
335 */
336void
337thread_free(struct thread *td)
338{
339
329 return (td);
330}
331
332
333/*
334 * Deallocate a thread.
335 */
336void
337thread_free(struct thread *td)
338{
339
340 cpu_thread_clean(td);
340 cpu_thread_free(td);
341 if (td->td_altkstack != 0)
342 vm_thread_dispose_altkstack(td);
343 if (td->td_kstack != 0)
344 vm_thread_dispose(td);
345 uma_zfree(thread_zone, td);
346}
347
348/*

--- 633 unchanged lines hidden ---
341 if (td->td_altkstack != 0)
342 vm_thread_dispose_altkstack(td);
343 if (td->td_kstack != 0)
344 vm_thread_dispose(td);
345 uma_zfree(thread_zone, td);
346}
347
348/*

--- 633 unchanged lines hidden ---