History

Merge branch 'main' into emscripten-and-ios

Jack Atherton committed 5 years ago

Commit 8da8c8b2 parents a303f34 f524ce142 files · +13346 −6064Browse files

Showing the changes to src/core/chuck.cpp (1 of 42 files). Show all

Unified · Split

src/core/chuck.cpp+36−7
@@ -90,7 +90,7 @@ · 89 unmodified lines
90 90
91 91
92// chuck statics92// chuck statics
93const char ChucK::VERSION[] = "1.4.0.0 (numchucks)";93const char ChucK::VERSION[] = "1.4.0.1 (numchucks)";
94t_CKUINT ChucK::o_numVMs = 0;94t_CKUINT ChucK::o_numVMs = 0;
95t_CKBOOL ChucK::o_isGlobalInit = FALSE;95t_CKBOOL ChucK::o_isGlobalInit = FALSE;
96t_CKBOOL ChucK::enableSystemCall = FALSE;96t_CKBOOL ChucK::enableSystemCall = FALSE;
@@ -140,6 +140,8 @@ ChucK::ChucK() · 43 unmodified lines
140 initDefaultParams();140 initDefaultParams();
141 // did user init?141 // did user init?
142 m_init = FALSE;142 m_init = FALSE;
143 // zero out the hook
144 m_hook = NULL; // m_hook = nullptr
143 145
144 // global init, if needed146 // global init, if needed
145 if( !o_isGlobalInit ) globalInit();147 if( !o_isGlobalInit ) globalInit();
@@ -684,22 +686,23 @@ bool ChucK::shutdown() · 538 unmodified lines
684 stk_detach( m_carrier );686 stk_detach( m_carrier );
685 687
686 // cancel otf thread688 // cancel otf thread
687#ifndef __DISABLE_OTF_SERVER__689 if(m_carrier->otf_thread)
690 {
688#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)691#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)
689 if( m_carrier->otf_thread ) pthread_cancel( m_carrier->otf_thread );692 pthread_cancel( m_carrier->otf_thread );
690#else693#else
691 if( m_carrier->otf_thread ) CloseHandle( m_carrier->otf_thread );694 CloseHandle( m_carrier->otf_thread ); // doesn't cancel thread
692#endif695#endif
696 m_carrier->otf_thread = 0; // signals thread shutdown
697 }
698
693 // close otf socket699 // close otf socket
694 if( m_carrier->otf_socket ) ck_close( m_carrier->otf_socket );700 if( m_carrier->otf_socket ) ck_close( m_carrier->otf_socket );
695 701
696 // reset702 // reset
697 m_carrier->otf_socket = NULL;703 m_carrier->otf_socket = NULL;
698 m_carrier->otf_port = 0;704 m_carrier->otf_port = 0;
699 m_carrier->otf_thread = 0;
700 705
701#endif
702
703 // TODO: a different way to unlock?706 // TODO: a different way to unlock?
704 // unlock all objects to delete chout, cherr707 // unlock all objects to delete chout, cherr
705 Chuck_VM_Object::unlock_all();708 Chuck_VM_Object::unlock_all();
@@ -1715,3 +1718,29 @@ void ChucK::poop() · 1009 unmodified lines
1715 ::uh();1718 ::uh();
1716 #endif1719 #endif
1717}1720}
1721
1722
1723
1724
1725//-----------------------------------------------------------------------------
1726// name: setMainThreadHook()
1727// desc: set a function pointer to call from the main thread loop
1728// e.g., for graphics, MAUI, potentially from a chug-in
1729//-----------------------------------------------------------------------------
1730bool ChucK::setMainThreadHook(Chuck_DL_MainThreadHook * hook)
1731{
1732 m_hook = hook;
1733 return true;
1734}
1735
1736
1737
1738
1739//-----------------------------------------------------------------------------
1740// name: getMainThreadHook()
1741// desc: get pointer to current function to be called from main loop
1742//-----------------------------------------------------------------------------
1743Chuck_DL_MainThreadHook * ChucK::getMainThreadHook()
1744{
1745 return m_hook;
1746}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t