Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -3382,9 +3382,18 @@ check_envname(const char *name)
}
#endif

static void
check_running_threads(void)
{
if (!rb_thread_alone())
rb_raise(rb_eRuntimeError, "cannot setenv() in a multi-threaded program");
}

void
ruby_setenv(const char *name, const char *value)
{
check_running_threads();

#if defined(_WIN32)
# if defined(MINGW_HAS_SECURE_API) || RUBY_MSVCRT_VERSION >= 80
# define HAVE__WPUTENV_S 1
Expand Down