Skip to content

Commit

Permalink
Update the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Maher committed Feb 15, 2010
1 parent 5f9bac2 commit 7a4b879
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This cmake file was inspired by:
# Copyright (C) 2007-2009 LuaDist.
# Submitted by David Manura
# Redistribution and use of this file is allowed according to the
Expand Down
43 changes: 31 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* The MIT License
*
* Copyright (c) 2009 Brian Maher
* Copyright (c) 2009-1010 Brian Maher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -41,14 +41,6 @@ Loading the library:
the function "luaopen_ev(L)". It will create a table with the ev
functions and leave it on the stack.

IMPORTANT IMPLEMENTATION NOTE:

Currently all callbacks registered by this implementation
rely on a thread-local in order to get the current lua_State.
This means any call in other C code directly to the ev_loop() C
API function call may cause fatal errors. If you have ideas on
how to lift this restriction, please let the maintainer know!

-- ev functions --

major, minor = ev.version()
Expand Down Expand Up @@ -227,9 +219,10 @@ revents = timer:clear_pending()

See also ev_clear_pending() C function.

on_timeout = timer:callback()
old_on_timeout = timer:callback([new_on_timeout])

Get access to the callback function associated with this timer.
Get access to the callback function associated with this timer,
optionally setting a new callback function.

-- ev.IO object methods --

Expand Down Expand Up @@ -273,5 +266,31 @@ revents = io:clear_pending()

on_timeout = io:callback()

Get access to the callback function associated with this io.
Get access to the callback function associated with this timer,
optionally setting a new callback function.

EXCEPTION HANDLING NOTE:

If there is an exception when calling a watcher callback, the error
will be printed to stderr. In the future, it would be cool if
there was a linked list of error handlers, and that if a callback
registers another callback, this linked list of error handlers
would be inherited so that exception handling can be done more
easily. To do this, we just need to add a method for adding an
error handler for the current callback context, and keep calling
the error handlers in the linked list until an error handler
actually handles the exception. If the error handling stack
unwinds, we will probably just resort to printing to stderr.

IMPROVEMENT NOTE:

You can now call ev_loop() directly from the C API (in the past
there was assumptions in the callback implementation).

TODO:

* Make the pthread library optional (currently we just register the
libev ev_default_fork function via pthread_atfork).

* Add support for other watcher types (signals, stat, periodic,
child, idle, embed, async, etc).

0 comments on commit 7a4b879

Please sign in to comment.