Path: blob/main/system/lib/pthread/emscripten_thread_init.c
6171 views
/*1* Copyright 2021 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/6#include <pthread.h>7#include "emscripten/threading.h"8#include "threading_internal.h"9#include "pthread_impl.h"1011void _emscripten_thread_init(pthread_t ptr,12int is_main,13int is_runtime,14int can_block,15int default_stacksize,16int start_profiling) {17__set_thread_state(ptr, is_main, is_runtime, can_block);18// Set `__default_stacksize` just once when the main runtime thread is19// started. The value of `DEFAULT_PTHREAD_STACK_SIZE` is passed in here as20// `default_stacksize`.21if (is_runtime && default_stacksize) {22__default_stacksize = default_stacksize;23}24#ifndef NDEBUG25if (start_profiling) {26_emscripten_thread_profiler_enable();27}28emscripten_set_current_thread_status(EM_THREAD_STATUS_RUNNING);29#endif30}313233