aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/iothread.h
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-01 21:01:00 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-01 21:54:54 -0700
commit483b7988632d864c65e4b68fc4a92133b172bbfe (patch)
tree495b440337b569ea8f0921fcfd9abb3ef55fb9da /src/iothread.h
parentb19bfc0dd3e9f5a0f8530ebccf207cef0824de7e (diff)
restyle iothread module to match project style
Reduces lint errors from 41 to 26 (-37%). Line count from 444 to 423 (-5%). Another step in resolving issue #2902.
Diffstat (limited to 'src/iothread.h')
-rw-r--r--src/iothread.h66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/iothread.h b/src/iothread.h
index 26b77550..ec57be68 100644
--- a/src/iothread.h
+++ b/src/iothread.h
@@ -1,54 +1,50 @@
-/** \file iothread.h
- Handles IO that may hang.
-*/
+// Handles IO that may hang.
#ifndef FISH_IOTHREAD_H
#define FISH_IOTHREAD_H
-/**
- Runs a command on a thread.
-
- \param handler The function to execute on a background thread. Accepts an arbitrary context pointer, and returns an int, which is passed to the completionCallback.
- \param completionCallback The function to execute on the main thread once the background thread is complete. Accepts an int (the return value of handler) and the context.
- \param context A arbitary context pointer to pass to the handler and completion callback.
- \return A sequence number, currently not very useful.
-*/
-int iothread_perform_base(int (*handler)(void *), void (*completionCallback)(void *, int), void *context);
-
-/**
- Gets the fd on which to listen for completion callbacks.
-
- \return A file descriptor on which to listen for completion callbacks.
-*/
+/// Runs a command on a thread.
+///
+/// \param handler The function to execute on a background thread. Accepts an arbitrary context
+/// pointer, and returns an int, which is passed to the completionCallback.
+/// \param completionCallback The function to execute on the main thread once the background thread
+/// is complete. Accepts an int (the return value of handler) and the context.
+/// \param context A arbitary context pointer to pass to the handler and completion callback.
+/// \return A sequence number, currently not very useful.
+int iothread_perform_base(int (*handler)(void *), void (*completionCallback)(void *, int),
+ void *context);
+
+/// Gets the fd on which to listen for completion callbacks.
+///
+/// \return A file descriptor on which to listen for completion callbacks.
int iothread_port(void);
-/** Services one iothread competion callback. */
+/// Services one iothread competion callback.
void iothread_service_completion(void);
-/** Waits for all iothreads to terminate. */
+/// Waits for all iothreads to terminate.
void iothread_drain_all(void);
-/** Performs a function on the main thread, blocking until it completes */
+/// Performs a function on the main thread, blocking until it completes.
int iothread_perform_on_main_base(int (*handler)(void *), void *context);
-/** Helper templates */
-template<typename T>
-int iothread_perform(int (*handler)(T *), void (*completionCallback)(T *, int), T *context)
-{
- return iothread_perform_base((int (*)(void *))handler, (void (*)(void *, int))completionCallback, static_cast<void *>(context));
+/// Helper templates.
+template <typename T>
+int iothread_perform(int (*handler)(T *), void (*completionCallback)(T *, int), T *context) {
+ return iothread_perform_base((int (*)(void *))handler,
+ (void (*)(void *, int))completionCallback,
+ static_cast<void *>(context));
}
-/* Variant that takes no completion callback */
-template<typename T>
-int iothread_perform(int (*handler)(T *), T *context)
-{
- return iothread_perform_base((int (*)(void *))handler, (void (*)(void *, int))0, static_cast<void *>(context));
+// Variant that takes no completion callback.
+template <typename T>
+int iothread_perform(int (*handler)(T *), T *context) {
+ return iothread_perform_base((int (*)(void *))handler, (void (*)(void *, int))0,
+ static_cast<void *>(context));
}
-template<typename T>
-int iothread_perform_on_main(int (*handler)(T *), T *context)
-{
+template <typename T>
+int iothread_perform_on_main(int (*handler)(T *), T *context) {
return iothread_perform_on_main_base((int (*)(void *))handler, (void *)(context));
}
-
#endif