diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index a56e83cdf4..f4debb4164 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1905,6 +1905,11 @@ void thread_base::start() m_thread = ::_beginthreadex(nullptr, 0, entry_point, this, CREATE_SUSPENDED, nullptr); ensure(m_thread); ensure(::ResumeThread(reinterpret_cast(+m_thread)) != -1); +#elif defined(__APPLE__) + pthread_attr_t stack_size_attr; + pthread_attr_init(&stack_size_attr); + pthread_attr_setstacksize(&stack_size_attr, 0x200000); + ensure(pthread_create(reinterpret_cast(&m_thread.raw()), &stack_size_attr, entry_point, this) == 0); #else ensure(pthread_create(reinterpret_cast(&m_thread.raw()), nullptr, entry_point, this) == 0); #endif diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 8db1996a69..cae695ddb4 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -508,6 +508,19 @@ int main(int argc, char** argv) setenv( "KDE_DEBUG", "1", 0 ); #endif +#ifdef __APPLE__ + struct ::rlimit rlim; + ::getrlimit(RLIMIT_NOFILE, &rlim); + rlim.rlim_cur = OPEN_MAX; + if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0) + std::cerr << "Failed to set max open file limit (" << OPEN_MAX << ").\n"; +#endif + +#ifndef _WIN32 + // Write file limits + sys_log.notice("Maximum open file descriptors: %i", utils::get_maxfiles()); +#endif + std::lock_guard qt_init(s_qt_init); // The constructor of QApplication eats the --style and --stylesheet arguments.