Ejemplo n.º 1
0
void uaenet_close (void *vsd)
{
	struct uaenetdatawin32 *sd = (struct uaenetdatawin32*)vsd;
	if (!sd)
		return;
	if (sd->threadactiver) {
		sd->threadactiver = -1;
	}
	if (sd->threadactivew) {
		sd->threadactivew = -1;
		SetEvent (sd->evttw);
	}
	if (sd->threadactiver) {
		while (sd->threadactiver)
			Sleep(10);
		write_log (L"uaenet_win32 thread %d killed\n", sd->tidr);
		uae_end_thread (&sd->tidr);
	}
	if (sd->threadactivew) {
		while (sd->threadactivew)
			Sleep(10);
		CloseHandle (sd->evttw);
		write_log (L"uaenet_win32 thread %d killed\n", sd->tidw);
		uae_end_thread (&sd->tidw);
	}
	xfree (sd->readbuffer);
	xfree (sd->writebuffer);
	if (sd->fp)
		pcap_close (sd->fp);
	uaeser_initdata (sd, sd->user);
	write_log (L"uaenet_win32 closed\n");
}
Ejemplo n.º 2
0
void free_traps(void)
{
	for (int i = 0; i < TRAP_THREADS; i++) {
		if (trap_thread_id[i]) {
			if (hardware_trap_kill[i] >= 0) {
				hardware_trap_kill[i] = 0;
				write_comm_pipe_pvoid(&trap_thread_pipe[i], NULL, 1);
				while (hardware_trap_kill[i] == 0) {
					sleep_millis(1);
				}
			}
			destroy_comm_pipe(&trap_thread_pipe[i]);
			uae_end_thread(&trap_thread_id[i]);
			trap_thread_id[i] = NULL;
		}
	}
}
Ejemplo n.º 3
0
void uae_slirp_end (void)
{
#ifdef WITH_QEMU_SLIRP
	if (impl == QEMU_IMPLEMENTATION) {
		UAE_LOG_STUB("");
		return;
	}
#endif
#ifdef WITH_BUILTIN_SLIRP
	if (impl == BUILTIN_IMPLEMENTATION) {
		if (slirp_thread_active > 0) {
			slirp_thread_active = 0;
			while (slirp_thread_active == 0) {
				sleep_millis (10);
			}
			uae_end_thread (&slirp_tid);
		}
		slirp_thread_active = 0;
		return;
	}
#endif
}