Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r--source/creator/creator.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c
index ea64184c826..9268ed15923 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -125,7 +125,7 @@ void main_python_exit(void);
* patched USD (see usd.diff) to avoid that particular static constructor, and have an
* initialization function instead.
*
- * This function is implemented in the USD source code, pxr/base/lib/plug/initConfig.cpp.
+ * This function is implemented in the USD source code, `pxr/base/lib/plug/initConfig.cpp`.
*/
void usd_initialise_plugin_path(const char *datafiles_usd_path);
#endif
@@ -158,7 +158,7 @@ static void callback_mem_error(const char *errorStr)
static void main_callback_setup(void)
{
- /* Error output from the alloc routines: */
+ /* Error output from the guarded allocation routines. */
MEM_set_error_callback(callback_mem_error);
}
@@ -208,7 +208,7 @@ static void callback_clg_fatal(void *fp)
static void *evil_C = NULL;
# ifdef __APPLE__
-/* environ is not available in mac shared libraries */
+/* Environment is not available in macOS shared libraries. */
# include <crt_externs.h>
char **environ = NULL;
# endif
@@ -246,20 +246,24 @@ int main(int argc,
struct CreatorAtExitData app_init_data = {NULL};
BKE_blender_atexit_register(callback_main_atexit, &app_init_data);
- /* Unbuffered stdout makes stdout and stderr better synchronized, and helps
+ /* Un-buffered `stdout` makes `stdout` and `stderr` better synchronized, and helps
* when stepping through code in a debugger (prints are immediately
- * visible). */
+ * visible). However disabling buffering causes lock contention on windows
+ * see T76767 for details, since this is a debugging aid, we do not enable
+ * the un-buffered behavior for release builds. */
+#ifndef NDEBUG
setvbuf(stdout, NULL, _IONBF, 0);
+#endif
#ifdef WIN32
- /* We delay loading of openmp so we can set the policy here. */
+ /* We delay loading of OPENMP so we can set the policy here. */
# if defined(_MSC_VER)
_putenv_s("OMP_WAIT_POLICY", "PASSIVE");
# endif
- /* Win32 Unicode Args */
+ /* Win32 Unicode Arguments. */
/* NOTE: cannot use guardedalloc malloc here, as it's not yet initialized
- * (it depends on the args passed in, which is what we're getting here!)
+ * (it depends on the arguments passed in, which is what we're getting here!)
*/
{
wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
@@ -291,6 +295,7 @@ int main(int argc,
break;
}
}
+ MEM_initialize_memleak_detection();
}
#ifdef BUILD_DATE
@@ -341,7 +346,7 @@ int main(int argc,
main_callback_setup();
#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE) && !defined(WITH_HEADLESS)
- /* patch to ignore argument finder gives us (pid?) */
+ /* Patch to ignore argument finder gives us (PID?) */
if (argc == 2 && STREQLEN(argv[1], "-psn_", 5)) {
extern int GHOST_HACK_getFirstFile(char buf[]);
static char firstfilebuf[512];
@@ -415,7 +420,7 @@ int main(int argc,
RE_engines_init();
init_nodesystem();
psys_init_rng();
- /* end second init */
+ /* End second initialization. */
#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
/* Python module mode ALWAYS runs in background-mode (for now). */
@@ -471,7 +476,7 @@ int main(int argc,
* #WM_init() before #BPY_python_start() crashes Blender at startup.
*/
- /* TODO - U.pythondir */
+ /* TODO: #U.pythondir */
#else
printf(
"\n* WARNING * - Blender compiled without Python!\n"
@@ -528,7 +533,7 @@ int main(int argc,
WM_main(C);
return 0;
-} /* end of int main(argc, argv) */
+} /* End of int main(...) function. */
#ifdef WITH_PYTHON_MODULE
void main_python_exit(void)