Perform the following procedure to run the Atom library's server processing in a separate thread created by the user.
- When initializing the library, specify the user multithread model.
- Create a thread, and then call the server processing function at a regular interval on that threads.
The following is a code sample that demonstrates this procedure.
#define USER_THREAD_PRIORITY_AUDIO (8)
#define USER_THREAD_PRIORITY_FILEACCESS (12)
#define USER_THREAD_PRIORITY_DATADECOMP (24)
:
static void app_audio_process(void *arg)
{
(void)arg;
}
static void app_file_access_process(void *arg)
{
(void)arg;
criFs_ExecuteFileAccess();
}
static void app_data_decomp_process(void *arg)
{
(void)arg;
criFs_ExecuteDataDecompression();
}
:
void Sample_Initialize(void)
{
:
:
smputl_initialize(&criatomex_config, NULL, 0);
:
:
:
:
{
CriUint32 thread_work_size;
thread_work_size = userThread_CalculateWorkSize();
user_audio_thread_work = user_alloc_func(NULL, thread_work_size);
user_file_access_thread_work = user_alloc_func(NULL, thread_work_size);
user_data_decomp_thread_work = user_alloc_func(NULL, thread_work_size);
user_audio_thread = userThread_Create(
user_audio_thread_work, thread_work_size,
app_audio_process, app_obj, USER_THREAD_PRIORITY_AUDIO, 0);
user_file_access_thread = userThread_Create(
user_file_access_thread_work, thread_work_size,
app_file_access_process, app_obj, USER_THREAD_PRIORITY_FILEACCESS, THREAD_AFFINITY_CORE2);
user_data_decomp_thread = userThread_Create(
user_data_decomp_thread_work, thread_work_size,
app_data_decomp_process, app_obj, USER_THREAD_PRIORITY_DATADECOMP, THREAD_AFFINITY_CORE2);
}
}
#define criAtomEx_SetDefaultConfig(p_config)
Assign the default values to the configuration structure used for the library's initialization.
Definition: cri_le_atom_ex.h:322
void criAtomEx_ExecuteAudioProcess(void)
Execute the server processing for user multithreading.
@ CRIATOMEX_THREAD_MODEL_USER_MULTI
User multithreading.
Definition: cri_le_atom_ex.h:1269