io_thread: add function io_thread_quit()
This commit is contained in:
		| @@ -75,12 +75,19 @@ io_thread_start(GError **error_r) | |||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| io_thread_deinit(void) | io_thread_quit(void) | ||||||
| { | { | ||||||
| 	if (io.thread != NULL) { |  | ||||||
| 	assert(io.loop != NULL); | 	assert(io.loop != NULL); | ||||||
|  |  | ||||||
| 	g_main_loop_quit(io.loop); | 	g_main_loop_quit(io.loop); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void | ||||||
|  | io_thread_deinit(void) | ||||||
|  | { | ||||||
|  | 	if (io.thread != NULL) { | ||||||
|  | 		io_thread_quit(); | ||||||
|  |  | ||||||
| 		g_thread_join(io.thread); | 		g_thread_join(io.thread); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,6 +37,14 @@ io_thread_start(GError **error_r); | |||||||
| void | void | ||||||
| io_thread_run(void); | io_thread_run(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Ask the I/O thread to quit, but does not wait for it.  Usually, you | ||||||
|  |  * don't need to call this function, because io_thread_deinit() | ||||||
|  |  * includes this. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | io_thread_quit(void); | ||||||
|  |  | ||||||
| void | void | ||||||
| io_thread_deinit(void); | io_thread_deinit(void); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann