give app its own thread
This commit is contained in:
parent
13d927e752
commit
c3d395a44e
@ -201,11 +201,7 @@ struct sys_file_map {
|
|||||||
|
|
||||||
struct sys_file_map sys_file_map_open_read(struct sys_file file);
|
struct sys_file_map sys_file_map_open_read(struct sys_file file);
|
||||||
void sys_file_map_close(struct sys_file_map map);
|
void sys_file_map_close(struct sys_file_map map);
|
||||||
|
struct buffer sys_file_map_data(struct sys_file_map map);
|
||||||
INLINE struct buffer sys_file_map_data(struct sys_file_map map)
|
|
||||||
{
|
|
||||||
return map.mapped_memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
* Dir iter
|
* Dir iter
|
||||||
@ -392,7 +388,7 @@ struct tls_table *sys_thread_get_tls(void);
|
|||||||
* Threads
|
* Threads
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
#define SYS_THREAD_STACK_SIZE MEGABYTE(1)
|
#define SYS_THREAD_STACK_SIZE MEGABYTE(2)
|
||||||
|
|
||||||
#define SYS_THREAD_FUNC_DEF(name, arg_name) void name(void *arg_name)
|
#define SYS_THREAD_FUNC_DEF(name, arg_name) void name(void *arg_name)
|
||||||
typedef SYS_THREAD_FUNC_DEF(sys_thread_func, data);
|
typedef SYS_THREAD_FUNC_DEF(sys_thread_func, data);
|
||||||
|
|||||||
@ -440,6 +440,11 @@ void sys_file_map_close(struct sys_file_map map)
|
|||||||
CloseHandle((HANDLE)map.handle);
|
CloseHandle((HANDLE)map.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct buffer sys_file_map_data(struct sys_file_map map)
|
||||||
|
{
|
||||||
|
return map.mapped_memory;
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
* Dir iter
|
* Dir iter
|
||||||
* ========================== */
|
* ========================== */
|
||||||
@ -1766,6 +1771,12 @@ void sys_sleep(f64 seconds)
|
|||||||
* Entry point
|
* Entry point
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
|
INTERNAL SYS_THREAD_FUNC_DEF(app_thread_entry_point, arg)
|
||||||
|
{
|
||||||
|
(UNUSED)arg;
|
||||||
|
app_entry_point();
|
||||||
|
}
|
||||||
|
|
||||||
int CALLBACK WinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, _In_ LPSTR command_line, _In_ int show_code)
|
int CALLBACK WinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, _In_ LPSTR command_line, _In_ int show_code)
|
||||||
{
|
{
|
||||||
(UNUSED)instance;
|
(UNUSED)instance;
|
||||||
@ -1867,8 +1878,9 @@ error:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* App */
|
/* Create app thread & wait for return */
|
||||||
app_entry_point();
|
struct sys_thread app_thread = sys_thread_init(&app_thread_entry_point, NULL, STR("[P9] App thread"));
|
||||||
|
sys_thread_join(&app_thread);
|
||||||
|
|
||||||
win32_tls_release(&main_thread_tls);
|
win32_tls_release(&main_thread_tls);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user