1 // Take a look at the license at the top of the repository in the LICENSE file.
2 
3 use glib::translate::FromGlibPtrFull;
4 use glib::Cast;
5 
6 use crate::SocketService;
7 use crate::ThreadedSocketService;
8 
9 impl ThreadedSocketService {
10     #[doc(alias = "g_threaded_socket_service_new")]
new(max_threads: Option<u32>) -> ThreadedSocketService11     pub fn new(max_threads: Option<u32>) -> ThreadedSocketService {
12         let max_threads = max_threads.map(|x| x as i32).unwrap_or(-1);
13         unsafe {
14             SocketService::from_glib_full(ffi::g_threaded_socket_service_new(max_threads))
15                 .unsafe_cast()
16         }
17     }
18 }
19