* garrow_thread_pool_new: * @n_threads: The number of threads in the pool. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GArrowThreadPool on success, * %NULL on error. * * Since: 23.0.0 */
| 124 | * Since: 23.0.0 |
| 125 | */ |
| 126 | GArrowThreadPool * |
| 127 | garrow_thread_pool_new(guint n_threads, GError **error) |
| 128 | { |
| 129 | auto arrow_thread_pool_result = arrow::internal::ThreadPool::Make(n_threads); |
| 130 | if (garrow::check(error, arrow_thread_pool_result, "[thread-pool][new]")) { |
| 131 | auto arrow_thread_pool = *arrow_thread_pool_result; |
| 132 | auto thread_pool = GARROW_THREAD_POOL( |
| 133 | g_object_new(GARROW_TYPE_THREAD_POOL, "executor", &arrow_thread_pool, nullptr)); |
| 134 | return thread_pool; |
| 135 | } else { |
| 136 | return nullptr; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | G_END_DECLS |
| 141 |