History

clean up after otf thread

Jack Atherton committed 9 years ago

Commit 83c52371 parent 61e2e111 file · +18 −3Browse files

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

Unified · Split

src/core/chuck.cpp+18−3
@@ -605,6 +605,23 @@ bool ChucK::shutdown() · 604 unmodified lines
605605 }
606606
607607 // free vm, compiler, friends
608+ // first, otf
609+ // REFACTOR-2017 TODO: le_cb?
610+
611+ // cancel otf thread
612+#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)
613+ if( m_carrier->otf_thread ) pthread_cancel( m_carrier->otf_thread );
614+#else
615+ if( m_carrier->otf_thread ) CloseHandle( m_carrier->otf_thread );
616+#endif
617+ // close otf socket
618+ if( m_carrier->otf_socket ) ck_close( m_carrier->otf_socket );
619+
620+ // reset
621+ m_carrier->otf_socket = NULL;
622+ m_carrier->otf_port = 0;
623+ m_carrier->otf_thread = 0;
624+
608625 // TODO: a different way to unlock?
609626 // unlock all objects to delete chout, cherr
610627 Chuck_VM_Object::unlock_all();
@@ -612,12 +629,10 @@ bool ChucK::shutdown() · 1 unmodified line
612629 SAFE_RELEASE( m_carrier->cherr );
613630 // relock
614631 Chuck_VM_Object::lock_all();
632+ // clean up vm, compiler
615633 SAFE_DELETE( m_carrier->vm );
616634 SAFE_DELETE( m_carrier->compiler );
617635 m_carrier->env = NULL;
618− m_carrier->otf_socket = NULL; // TODO: properly dealloc
619− m_carrier->otf_port = 0;
620− m_carrier->otf_thread = 0; // TODO: properly dealloc
621636
622637 // flag
623638 m_init = FALSE;

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