polar-objc 5.44
An Objective-C runtime library
Loading...
Searching...
No Matches
polar-threading.h
1/* Internal API: thread management for polar-objc.
2 Copyright (C) 2022-2025 Michael Malicoat <[email protected]>
3
4 This file is part of polar-objc.
5
6 polar-objc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
8
9 polar-objc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
10 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 details.
12
13 You should have received a copy of the GNU General Public License along with this program; see the file LICENSE. If
14 not, see <http://www.gnu.org/licenses/>.
15*/
16#ifndef POLAR_THREADING_H
17#define POLAR_THREADING_H
18
19POLAR_FUNCTION_INTERNAL intptr_t
20polar_thread_split( thrd_t *out_thread_id, polar_func_thread_enter func_thread_enter, void *thread_entry_data,
21 polar_thread_message_queue *thread_new_inbox );
22
23POLAR_FUNCTION_INTERNAL polar_thread_data *
24polar_thread_current_get_data( BOOL flag_allocate_on_demand );
25
26// This is passed as a destructor to tss_create() and so must be a standard C function
27void
28polar_thread_current_exit( void );
29
30// Called by polar_init()
31POLAR_FUNCTION_INTERNAL intptr_t
32polar_threading_init( void );
33
34// Called by polar_finalize()
35POLAR_FUNCTION_INTERNAL void
36polar_threading_finalize( void );
37
38static inline polar_thread_message_queue *
39polar_thread_current_get_inbox( void )
40{
41 return polar_thread_data_get_inbox( polar_thread_current_get_data(YES) );
42}
43
44#endif //POLAR_THREADING_H
DWORD thrd_t
Definition polar-windows-platform-threading.h:111
Definition polar-thread-data.h:31
Definition polar-thread-message-queue.h:23