Skip to content

Commit

Permalink
Make pending streams not call OSTerminateThread on early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
palana committed Oct 3, 2014
1 parent 9c10e0f commit c4a77ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions OBSApi/Utility/RAIIHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ struct ThreadDeleter
void operator()(HANDLE h) const { if (!h) return; OSTerminateThread(h, args ...); }
};

template <DWORD exitCode=0>
struct ThreadTerminator
{
void operator()(HANDLE h) const { if (!h) return; Log(L"Terminating 0x%x", GetThreadId(h)); TerminateThread(h, exitCode); }
};

struct ScopedLock
{
bool locked, unlock;
Expand Down
2 changes: 1 addition & 1 deletion Source/OBS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ class OBS

struct PendingStreams
{
using thread_t = std::unique_ptr<void, ThreadDeleter<>>;
using thread_t = std::unique_ptr<void, ThreadTerminator<>>;
std::list<thread_t> streams;
std::unique_ptr<void, MutexDeleter> mutex;
PendingStreams() : mutex(OSCreateMutex()) {}
Expand Down

0 comments on commit c4a77ac

Please sign in to comment.