mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2025-10-30 08:02:29 +00:00
* System to specify thread types by the game * Register threads callbacks * Remove temporary and permanent threads * Fix `pthread_setname_np` not liking names longer than 16 bytes * Singular * Rename events_callbacks arg * Use `prctl` instead of `pthread_setname_np` for naming a thread * Fix typo
29 lines
864 B
C++
29 lines
864 B
C++
#ifndef __THREADS_HPP__
|
|
#define __THREADS_HPP__
|
|
|
|
#include <string>
|
|
|
|
#include "ultra64.h"
|
|
|
|
namespace ultramodern {
|
|
namespace threads {
|
|
struct callbacks_t {
|
|
using get_game_thread_name_t = std::string(const OSThread* t);
|
|
|
|
/**
|
|
* Allows to specifying a custom name for each thread. Mainly for debugging purposes.
|
|
*
|
|
* For maximum cross-platform compatibility the returned name should be at most 15 bytes long (16 bytes including the null terminator).
|
|
*
|
|
* If this function is not provided then the thread id will be used as the name of the thread.
|
|
*/
|
|
get_game_thread_name_t *get_game_thread_name;
|
|
};
|
|
|
|
void set_callbacks(const callbacks_t& callbacks);
|
|
|
|
std::string get_game_thread_name(const OSThread* t);
|
|
}
|
|
}
|
|
|
|
#endif
|