Expose main thread id
This will allow to assert that a function is called from the main thread.
This commit is contained in:
parent
72d5bcc12a
commit
9cae029ef2
@ -16,6 +16,7 @@
|
|||||||
#include "usb/scrcpy_otg.h"
|
#include "usb/scrcpy_otg.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/net.h"
|
#include "util/net.h"
|
||||||
|
#include "util/thread.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -67,6 +68,9 @@ main_scrcpy(int argc, char *argv[]) {
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The current thread is the main thread
|
||||||
|
SC_MAIN_THREAD_ID = sc_thread_get_id();
|
||||||
|
|
||||||
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||||
av_register_all();
|
av_register_all();
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
sc_thread_id SC_MAIN_THREAD_ID;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sc_thread_create(sc_thread *thread, sc_thread_fn fn, const char *name,
|
sc_thread_create(sc_thread *thread, sc_thread_fn fn, const char *name,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
@ -39,6 +39,8 @@ typedef struct sc_cond {
|
|||||||
SDL_cond *cond;
|
SDL_cond *cond;
|
||||||
} sc_cond;
|
} sc_cond;
|
||||||
|
|
||||||
|
extern sc_thread_id SC_MAIN_THREAD_ID;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sc_thread_create(sc_thread *thread, sc_thread_fn fn, const char *name,
|
sc_thread_create(sc_thread *thread, sc_thread_fn fn, const char *name,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user