Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/pthread/emscripten_thread_init.c
6171 views
1
/*
2
* Copyright 2021 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*/
7
#include <pthread.h>
8
#include "emscripten/threading.h"
9
#include "threading_internal.h"
10
#include "pthread_impl.h"
11
12
void _emscripten_thread_init(pthread_t ptr,
13
int is_main,
14
int is_runtime,
15
int can_block,
16
int default_stacksize,
17
int start_profiling) {
18
__set_thread_state(ptr, is_main, is_runtime, can_block);
19
// Set `__default_stacksize` just once when the main runtime thread is
20
// started. The value of `DEFAULT_PTHREAD_STACK_SIZE` is passed in here as
21
// `default_stacksize`.
22
if (is_runtime && default_stacksize) {
23
__default_stacksize = default_stacksize;
24
}
25
#ifndef NDEBUG
26
if (start_profiling) {
27
_emscripten_thread_profiler_enable();
28
}
29
emscripten_set_current_thread_status(EM_THREAD_STATUS_RUNNING);
30
#endif
31
}
32
33