summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2011-06-05 22:44:30 +0000
committerroot <root>2011-06-05 22:44:30 +0000
commit562389953303997321d4f4517a27535ed3828c6e (patch)
tree92a8a2d5b1a08f1bbda52d6da4ae55918e57dfec
parent71e6cec06527558680f5d779a00d469205fd4567 (diff)
*** empty log message ***
-rw-r--r--Changes1
-rw-r--r--eio.c6
-rw-r--r--eio.h4
-rw-r--r--eio.pod162
4 files changed, 87 insertions, 86 deletions
diff --git a/Changes b/Changes
index 05996cb..7449b04 100644
--- a/Changes
+++ b/Changes
@@ -41,3 +41,4 @@ TODO: fadvise request
- fix memory corruption in eio_readdirx for the flags
combination EIO_READDIR_STAT_ORDER | EIO_READDIR_DIRS_FIRST.
- port to openbsd (another blatantly broken non-UNIX/POSIX platform).
+ - fix eio_custom prototype.
diff --git a/eio.c b/eio.c
index 07492cd..e066270 100644
--- a/eio.c
+++ b/eio.c
@@ -1780,7 +1780,7 @@ static void eio_execute (etp_worker *self, eio_req *req)
break;
case EIO_CUSTOM:
- ((void (*)(eio_req *))req->feed) (req);
+ req->feed (req);
break;
default:
@@ -2011,9 +2011,9 @@ eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb,
return eio__2path (EIO_RENAME, path, new_path, pri, cb, data);
}
-eio_req *eio_custom (eio_cb execute, int pri, eio_cb cb, void *data)
+eio_req *eio_custom (void (*)(eio_req *) execute, int pri, eio_cb cb, void *data);
{
- REQ (EIO_CUSTOM); req->feed = (void (*)(eio_req *))execute; SEND;
+ REQ (EIO_CUSTOM); req->feed = execute; SEND;
}
#endif
diff --git a/eio.h b/eio.h
index d0348b7..31168fd 100644
--- a/eio.h
+++ b/eio.h
@@ -249,7 +249,7 @@ unsigned int eio_npending (void); /* numbe rof finished but unhandled requests *
unsigned int eio_nthreads (void); /* number of worker threads in use currently */
/*****************************************************************************/
-/* convinience wrappers */
+/* convenience wrappers */
#ifndef EIO_NO_WRAPPERS
eio_req *eio_nop (int pri, eio_cb cb, void *data); /* does nothing except go through the whole process */
@@ -291,7 +291,7 @@ eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_c
eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
-eio_req *eio_custom (eio_cb execute, int pri, eio_cb cb, void *data);
+eio_req *eio_custom (void (*)(eio_req *) execute, int pri, eio_cb cb, void *data);
#endif
/*****************************************************************************/
diff --git a/eio.pod b/eio.pod
index fed01d3..2f8c526 100644
--- a/eio.pod
+++ b/eio.pod
@@ -140,87 +140,6 @@ C<eio_poll>. The race is avoided here because the event loop should invoke
your callback again and again until the byte has been read (as the pipe
read callback does not read it, only C<done_poll>).
-=head2 CONFIGURATION
-
-The functions in this section can sometimes be useful, but the default
-configuration will do in most case, so you should skip this section on
-first reading.
-
-=over 4
-
-=item eio_set_max_poll_time (eio_tstamp nseconds)
-
-This causes C<eio_poll ()> to return after it has detected that it was
-running for C<nsecond> seconds or longer (this number can be fractional).
-
-This can be used to limit the amount of time spent handling eio requests,
-for example, in interactive programs, you might want to limit this time to
-C<0.01> seconds or so.
-
-Note that:
-
-a) libeio doesn't know how long your request callbacks take, so the time
-spent in C<eio_poll> is up to one callback invocation longer then this
-interval.
-
-b) this is implemented by calling C<gettimeofday> after each request,
-which can be costly.
-
-c) at least one request will be handled.
-
-=item eio_set_max_poll_reqs (unsigned int nreqs)
-
-When C<nreqs> is non-zero, then C<eio_poll> will not handle more than
-C<nreqs> requests per invocation. This is a less costly way to limit the
-amount of work done by C<eio_poll> then setting a time limit.
-
-If you know your callbacks are generally fast, you could use this to
-encourage interactiveness in your programs by setting it to C<10>, C<100>
-or even C<1000>.
-
-=item eio_set_min_parallel (unsigned int nthreads)
-
-Make sure libeio can handle at least this many requests in parallel. It
-might be able handle more.
-
-=item eio_set_max_parallel (unsigned int nthreads)
-
-Set the maximum number of threads that libeio will spawn.
-
-=item eio_set_max_idle (unsigned int nthreads)
-
-Libeio uses threads internally to handle most requests, and will start and stop threads on demand.
-
-This call can be used to limit the number of idle threads (threads without
-work to do): libeio will keep some threads idle in preparation for more
-requests, but never longer than C<nthreads> threads.
-
-In addition to this, libeio will also stop threads when they are idle for
-a few seconds, regardless of this setting.
-
-=item unsigned int eio_nthreads ()
-
-Return the number of worker threads currently running.
-
-=item unsigned int eio_nreqs ()
-
-Return the number of requests currently handled by libeio. This is the
-total number of requests that have been submitted to libeio, but not yet
-destroyed.
-
-=item unsigned int eio_nready ()
-
-Returns the number of ready requests, i.e. requests that have been
-submitted but have not yet entered the execution phase.
-
-=item unsigned int eio_npending ()
-
-Returns the number of pending requests, i.e. requests that have been
-executed and have results, but have not been finished yet by a call to
-C<eio_poll>).
-
-=back
-
=head1 HIGH LEVEL REQUEST API
@@ -662,6 +581,87 @@ zero
#TODO
+=head2 CONFIGURATION
+
+The functions in this section can sometimes be useful, but the default
+configuration will do in most case, so you should skip this section on
+first reading.
+
+=over 4
+
+=item eio_set_max_poll_time (eio_tstamp nseconds)
+
+This causes C<eio_poll ()> to return after it has detected that it was
+running for C<nsecond> seconds or longer (this number can be fractional).
+
+This can be used to limit the amount of time spent handling eio requests,
+for example, in interactive programs, you might want to limit this time to
+C<0.01> seconds or so.
+
+Note that:
+
+a) libeio doesn't know how long your request callbacks take, so the time
+spent in C<eio_poll> is up to one callback invocation longer then this
+interval.
+
+b) this is implemented by calling C<gettimeofday> after each request,
+which can be costly.
+
+c) at least one request will be handled.
+
+=item eio_set_max_poll_reqs (unsigned int nreqs)
+
+When C<nreqs> is non-zero, then C<eio_poll> will not handle more than
+C<nreqs> requests per invocation. This is a less costly way to limit the
+amount of work done by C<eio_poll> then setting a time limit.
+
+If you know your callbacks are generally fast, you could use this to
+encourage interactiveness in your programs by setting it to C<10>, C<100>
+or even C<1000>.
+
+=item eio_set_min_parallel (unsigned int nthreads)
+
+Make sure libeio can handle at least this many requests in parallel. It
+might be able handle more.
+
+=item eio_set_max_parallel (unsigned int nthreads)
+
+Set the maximum number of threads that libeio will spawn.
+
+=item eio_set_max_idle (unsigned int nthreads)
+
+Libeio uses threads internally to handle most requests, and will start and stop threads on demand.
+
+This call can be used to limit the number of idle threads (threads without
+work to do): libeio will keep some threads idle in preparation for more
+requests, but never longer than C<nthreads> threads.
+
+In addition to this, libeio will also stop threads when they are idle for
+a few seconds, regardless of this setting.
+
+=item unsigned int eio_nthreads ()
+
+Return the number of worker threads currently running.
+
+=item unsigned int eio_nreqs ()
+
+Return the number of requests currently handled by libeio. This is the
+total number of requests that have been submitted to libeio, but not yet
+destroyed.
+
+=item unsigned int eio_nready ()
+
+Returns the number of ready requests, i.e. requests that have been
+submitted but have not yet entered the execution phase.
+
+=item unsigned int eio_npending ()
+
+Returns the number of pending requests, i.e. requests that have been
+executed and have results, but have not been finished yet by a call to
+C<eio_poll>).
+
+=back
+
=head1 EMBEDDING
Libeio can be embedded directly into programs. This functionality is not