// Take a look at the license at the top of the repository in the LICENSE file.
use glib::{prelude::*, translate::*};
use crate::{SocketService, ThreadedSocketService};
impl ThreadedSocketService {
/// Creates a new #GThreadedSocketService with no listeners. Listeners
/// must be added with one of the #GSocketListener "add" methods.
/// ## `max_threads`
/// the maximal number of threads to execute concurrently
/// handling incoming clients, -1 means no limit
///
/// # Returns
///
/// a new #GSocketService.
#[doc(alias = "g_threaded_socket_service_new")]
pub fn new(max_threads: Option<u32>) -> ThreadedSocketService {
let max_threads = max_threads.map(|x| x as i32).unwrap_or(-1);
unsafe {
SocketService::from_glib_full(ffi::g_threaded_socket_service_new(max_threads))
.unsafe_cast()
}
}
}