@@ -219,7 +219,7 @@ int uds_make_request_queue(const char *queue_name,
return result;
}
- result = uds_create_thread(request_queue_worker, queue, queue_name,
+ result = vdo_create_thread(request_queue_worker, queue, queue_name,
&queue->thread);
if (result != UDS_SUCCESS) {
uds_request_queue_finish(queue);
@@ -256,8 +256,6 @@ void uds_request_queue_enqueue(struct uds_request_queue *queue,
void uds_request_queue_finish(struct uds_request_queue *queue)
{
- int result;
-
if (queue == NULL)
return;
@@ -272,9 +270,7 @@ void uds_request_queue_finish(struct uds_request_queue *queue)
if (queue->started) {
wake_up_worker(queue);
- result = uds_join_threads(queue->thread);
- if (result != UDS_SUCCESS)
- uds_log_warning_strerror(result, "Failed to join worker thread");
+ vdo_join_threads(queue->thread);
}
uds_free_funnel_queue(queue->main_queue);
@@ -744,7 +744,7 @@ static void stop_chapter_writer(struct chapter_writer *writer)
mutex_unlock(&writer->mutex);
if (writer_thread != NULL)
- uds_join_threads(writer_thread);
+ vdo_join_threads(writer_thread);
}
static void free_chapter_writer(struct chapter_writer *writer)
@@ -796,7 +796,7 @@ static int make_chapter_writer(struct uds_index *index,
collated_records_size +
writer->open_chapter_index->memory_size);
- result = uds_create_thread(close_chapters, writer, "writer", &writer->thread);
+ result = vdo_create_thread(close_chapters, writer, "writer", &writer->thread);
if (result != UDS_SUCCESS) {
free_chapter_writer(writer);
return result;
@@ -82,7 +82,7 @@ static void do_status_code_registration(void)
*/
int vdo_register_status_codes(void)
{
- uds_perform_once(&vdo_status_codes_registered, do_status_code_registration);
+ vdo_perform_once(&vdo_status_codes_registered, do_status_code_registration);
return status_code_registration_result;
}
@@ -33,7 +33,7 @@ enum {
};
/* Run a function once only, and record that fact in the atomic value. */
-void uds_perform_once(atomic_t *once, void (*function)(void))
+void vdo_perform_once(atomic_t *once, void (*function)(void))
{
for (;;) {
switch (atomic_cmpxchg(once, ONCE_NOT_DONE, ONCE_IN_PROGRESS)) {
@@ -63,7 +63,7 @@ static int thread_starter(void *arg)
struct thread *thread = arg;
thread->thread_task = current;
- uds_perform_once(&thread_once, thread_init);
+ vdo_perform_once(&thread_once, thread_init);
mutex_lock(&thread_mutex);
hlist_add_head(&thread->thread_links, &thread_list);
mutex_unlock(&thread_mutex);
@@ -74,7 +74,7 @@ static int thread_starter(void *arg)
return 0;
}
-int uds_create_thread(void (*thread_function)(void *), void *thread_data,
+int vdo_create_thread(void (*thread_function)(void *), void *thread_data,
const char *name, struct thread **new_thread)
{
char *name_colon = strchr(name, ':');
@@ -123,7 +123,7 @@ int uds_create_thread(void (*thread_function)(void *), void *thread_data,
return UDS_SUCCESS;
}
-int uds_join_threads(struct thread *thread)
+void vdo_join_threads(struct thread *thread)
{
while (wait_for_completion_interruptible(&thread->thread_done))
fsleep(1000);
@@ -132,5 +132,4 @@ int uds_join_threads(struct thread *thread)
hlist_del(&thread->thread_links);
mutex_unlock(&thread_mutex);
uds_free(thread);
- return UDS_SUCCESS;
}
@@ -14,16 +14,15 @@
#include "errors.h"
-/* Thread and synchronization utilities for UDS */
+/* Thread and synchronization utilities */
struct thread;
-int __must_check uds_create_thread(void (*thread_function)(void *), void *thread_data,
+int __must_check vdo_create_thread(void (*thread_function)(void *), void *thread_data,
const char *name, struct thread **new_thread);
+void vdo_join_threads(struct thread *thread);
-void uds_perform_once(atomic_t *once_state, void (*function) (void));
-
-int uds_join_threads(struct thread *thread);
+void vdo_perform_once(atomic_t *once_state, void (*function) (void));
#endif /* UDS_THREADS_H */
@@ -1633,7 +1633,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
}
for (i = 0; i < config->read_threads; i++) {
- result = uds_create_thread(read_thread_function, (void *) volume,
+ result = vdo_create_thread(read_thread_function, (void *) volume,
"reader", &volume->reader_threads[i]);
if (result != UDS_SUCCESS) {
uds_free_volume(volume);
@@ -1675,7 +1675,7 @@ void uds_free_volume(struct volume *volume)
uds_broadcast_cond(&volume->read_threads_cond);
mutex_unlock(&volume->read_threads_mutex);
for (i = 0; i < volume->read_thread_count; i++)
- uds_join_threads(volume->reader_threads[i]);
+ vdo_join_threads(volume->reader_threads[i]);
uds_free(volume->reader_threads);
volume->reader_threads = NULL;
}