void Thread::stop() { if (!m_alive) return; Thread_destroy(m_handle); m_alive=false; }
void *IoThread_BeginThread(void *vti) { IoThreadInfo *ti = (IoThreadInfo *)vti; Thread *t = IoThreadInfo_thread(ti); IoState *state = IoThreadInfo_state(ti); Thread_setUserData_(t, state); IoState_doCString_(state, IoThreadInfo_evalString(ti)); IoThreadInfo_free(ti); IoState_free(state); Thread_destroy(t); return NULL; }
void IsoServer_stopListening(IsoServer self) { stopListening(self); if (self->serverThread != NULL) Thread_destroy(self->serverThread); closeAllOpenClientConnections(self); /* Wait for connection threads to finish */ while (private_IsoServer_getConnectionCounter(self) > 0) Thread_sleep(10); if (DEBUG_ISO_SERVER) printf("ISO_SERVER: IsoServer_stopListening finished!\n"); }
void IsoClientConnection_destroy(IsoClientConnection self) { if (self->state == STATE_ASSOCIATED) IsoClientConnection_close(self); if (self->thread != NULL) Thread_destroy(self->thread); if (self->cotpBuf != NULL) free(self->cotpBuf); if (self->cotpBuffer != NULL) free(self->cotpBuffer); if (self->cotpConnection != NULL) { CotpConnection_destroy(self->cotpConnection); free(self->cotpConnection); } if (self->session != NULL) free(self->session); if (self->presentation != NULL) free(self->presentation); free(self->buffer1); free(self->buffer2); free(self); }
IoObject *IoThread_endCurrentThread(IoObject *self, IoObject *locals, IoMessage *m) { // shutdown vm? Thread_destroy(Thread_CurrentThread()); return self; }