From dea7b526052ec923cfa3b743e13d121c703deecf Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 9 May 2020 00:34:51 -0400 Subject: [PATCH] Revert "Made thread names consistent." I don't know if I want to do this yet. This reverts commit 456fb594c09196bd74c9d758798df82a8e813493. --- common/programmererrors.h | 2 +- doc/init-main.md | 4 ++-- test/noinitwrongthread.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/programmererrors.h b/common/programmererrors.h index d299631a..a529878a 100644 --- a/common/programmererrors.h +++ b/common/programmererrors.h @@ -7,7 +7,7 @@ func) #define uiprivProgrammerErrorWrongThread(func) \ - uiprivProgrammerError("attempt to call %s() on a thread other than the UI thread", \ + uiprivProgrammerError("attempt to call %s() on a thread other than the GUI thread", \ func) #define uiprivProgrammerErrorWrongStructSize(badSize, structName, func) \ diff --git a/doc/init-main.md b/doc/init-main.md index bc764f62..4e6ff042 100644 --- a/doc/init-main.md +++ b/doc/init-main.md @@ -6,7 +6,7 @@ In order to use libui, you must first initialize it. All initialization is done through the `uiInit()` function. This is usually one of the first things you do in your program. -The thread you call `uiInit()` on becomes the "UI thread". This is the thread that all your UI is done on from the perspective of the operating system, so it is absolutely essential that you do **not** call any other function of libui from any other thread that you create (except for `uiQueueMain()`, which is discussed later). +The thread you call `uiInit()` on becomes the "GUI thread". This is the thread that all your UI is done on from the perspective of the operating system, so it is absolutely essential that you do **not** call any other function of libui from any other thread that you create (except for `uiQueueMain()`, which is discussed later). Furthermore, on some systems, this thread must also be the thread that `main()` is called on; macOS is the notable example here. Therefore, to be safe, you should only call `uiInit()` from `main()`, or from a function that runs on the same thread as `main()`. If you are using a language binding, that binding may provide further instruction on how to do so in that language. @@ -87,7 +87,7 @@ bool uiInit(void *options, uiInitError *err); `options` must be `NULL`; no options are currently defined. If `options` is not `NULL`, `uiInit()` will return an error without initializing anything. -As part of initialization, the thread that `uiInit()` is called on becomes the UI thread. All of the functions of libui except `uiQueueMain()` **must** be called from this thread. On platforms where which thread you run GUI code on is restricted, `uiMain()` will return an error if it is called from the wrong thread; to avoid this, you should always call `uiInit()` from the thread that `main()` itself is called from. +As part of initialization, the thread that `uiInit()` is called on becomes the GUI thread. All of the functions of libui except `uiQueueMain()` **must** be called from this thread. On platforms where which thread you run GUI code on is restricted, `uiMain()` will return an error if it is called from the wrong thread; to avoid this, you should always call `uiInit()` from the thread that `main()` itself is called from. If `uiInit()` fails, no other libui function is safe to call. This means that you cannot use any of libui's message box functions to report the error. diff --git a/test/noinitwrongthread.c b/test/noinitwrongthread.c index 30e2f5bf..44640b23 100644 --- a/test/noinitwrongthread.c +++ b/test/noinitwrongthread.c @@ -23,7 +23,7 @@ TestNoInit(FunctionsFailBeforeInit) } static const struct checkErrorCase wrongThreadCases[] = { -#define allcallsCase(f, ...) { #f "()", allcallsCaseFuncName(f), "attempt to call " #f "() on a thread other than the UI thread" }, +#define allcallsCase(f, ...) { #f "()", allcallsCaseFuncName(f), "attempt to call " #f "() on a thread other than the GUI thread" }, #include "allcalls.h" #undef allcallsCase { NULL, NULL, NULL },