Compare commits
No commits in common. "ce019229bb76ad7af90664bd6bf203db970a029a" and "151afec7f058fb39f18875162fcf97e70855e89b" have entirely different histories.
ce019229bb
...
151afec7f0
2 changed files with 0 additions and 16 deletions
|
|
@ -139,15 +139,10 @@ namespace psemek::log
|
||||||
level max_;
|
level max_;
|
||||||
};
|
};
|
||||||
|
|
||||||
thread_local bool this_thread_registered = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_thread(std::string name)
|
void register_thread(std::string name)
|
||||||
{
|
{
|
||||||
if (this_thread_registered)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef _PTHREAD_H
|
#ifdef _PTHREAD_H
|
||||||
#if (defined _GNU_SOURCE)
|
#if (defined _GNU_SOURCE)
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
|
|
@ -172,8 +167,6 @@ namespace psemek::log
|
||||||
thread_names[id] = std::make_unique<std::string>(name);
|
thread_names[id] = std::make_unique<std::string>(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_thread_registered = true;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
std::size_t current_max = max_thread_name_length.load();
|
std::size_t current_max = max_thread_name_length.load();
|
||||||
while(current_max < name.size() && !max_thread_name_length.compare_exchange_weak(current_max, name.size()))
|
while(current_max < name.size() && !max_thread_name_length.compare_exchange_weak(current_max, name.size()))
|
||||||
|
|
@ -185,9 +178,6 @@ namespace psemek::log
|
||||||
|
|
||||||
void unregister_thread(std::thread::id id)
|
void unregister_thread(std::thread::id id)
|
||||||
{
|
{
|
||||||
if (!this_thread_registered)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
{
|
{
|
||||||
std::lock_guard lock{thread_names_mutex};
|
std::lock_guard lock{thread_names_mutex};
|
||||||
|
|
@ -204,8 +194,6 @@ namespace psemek::log
|
||||||
thread_names.erase(it);
|
thread_names.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_thread_registered = false;
|
|
||||||
|
|
||||||
if (id == std::this_thread::get_id())
|
if (id == std::this_thread::get_id())
|
||||||
put_message(level::info, "Thread \"" + name + "\" unregistered", name);
|
put_message(level::info, "Thread \"" + name + "\" unregistered", name);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,7 @@ namespace psemek::sdl2
|
||||||
desired.freq = audio::frequency;
|
desired.freq = audio::frequency;
|
||||||
desired.channels = 2;
|
desired.channels = 2;
|
||||||
desired.format = AUDIO_F32SYS;
|
desired.format = AUDIO_F32SYS;
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
desired.samples = 256;
|
desired.samples = 256;
|
||||||
#else
|
|
||||||
desired.samples = 2048;
|
|
||||||
#endif
|
|
||||||
desired.callback = &callback<float>;
|
desired.callback = &callback<float>;
|
||||||
desired.userdata = this;
|
desired.userdata = this;
|
||||||
if (device_ = SDL_OpenAudioDevice(nullptr, 0, &desired, &obtained, 0); device_ == 0)
|
if (device_ = SDL_OpenAudioDevice(nullptr, 0, &desired, &obtained, 0); device_ == 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue