libtasks Documentation  1.6
tasks Namespace Reference

Namespaces

 net
 
 serial
 
 tools
 

Classes

class  cleanup_task
 
class  disk_io_task
 
class  dispatcher
 
class  disposable
 Base class for objects/tasks that can be deleted. More...
 
class  error_base
 A helper class for basic error reporting. More...
 
class  event_task
 
class  exec_task
 
class  executor
 
class  io_task_base
 This is the base class for io event tasks. It controls an ev_io watcher that monitors io events on file handles. More...
 
class  net_io_task
 The net_io_task implements the base for socket based network tasks. More...
 
class  serial_io_task
 The serial_io_task implements the base tasks that implement serial communication. More...
 
class  task
 The base class for any task. More...
 
class  tasks_exception
 Tasks execption class. More...
 
class  timer_task
 
struct  version_helper
 
struct  loop_t
 Needed to use std::unique_ptr<> More...
 
struct  task_func_queue_t
 
struct  event
 
class  worker
 
class  test_exec
 

Typedefs

typedef std::function< void(int)> signal_func_t
 
typedef std::function< void(struct
ev_loop *)> 
task_func_t
 

Enumerations

enum  tasks_error {
  tasks_error::SOCKET_SOCKET, tasks_error::SOCKET_SOCKOPT_NOSIGPIPE, tasks_error::SOCKET_SOCKOPT_REUSEADDR, tasks_error::SOCKET_FNCTL,
  tasks_error::SOCKET_BIND, tasks_error::SOCKET_CHMOD, tasks_error::SOCKET_LISTEN, tasks_error::SOCKET_LISTEN_UDP,
  tasks_error::SOCKET_ACCEPT, tasks_error::SOCKET_CONNECT, tasks_error::SOCKET_NOHOST, tasks_error::SOCKET_WRITE,
  tasks_error::SOCKET_READ, tasks_error::SOCKET_NOCON, tasks_error::HTTP_NOT_IMPL, tasks_error::HTTP_NO_CONTENT_LENGTH,
  tasks_error::HTTP_INVALID_STATUS_CODE, tasks_error::HTTP_INVALID_HEADER, tasks_error::UWSGI_HEADER_ERROR, tasks_error::UWSGI_NOT_IMPL,
  tasks_error::UWSGI_THRIFT_TRANSPORT, tasks_error::UWSGI_THRIFT_HANDLER, tasks_error::TERM_NO_DEVICE, tasks_error::TERM_TCGETATTR,
  tasks_error::TERM_TCSETATTR, tasks_error::TERM_OPEN, tasks_error::TERM_FCNTL, tasks_error::TERM_CFSETOSPEED,
  tasks_error::TERM_CFSETISPEED, tasks_error::TERM_INVALID_PARITY, tasks_error::TERM_INVALID_STOPBITS, tasks_error::TERM_INVALID_MODE,
  tasks_error::DISKIO_INVALID_EVENT, tasks_error::UNSET
}
 

Functions

void exec (exec_task::func_t f)
 Execute code in a separate executor thread. More...
 
void exec (exec_task::func_t f, task::finish_func_void_t ff)
 Execute code in a separate executor thread. More...
 
const char * version ()
 
template<typename EV_t >
void tasks_event_callback (struct ev_loop *loop, EV_t w, int e)
 Callback for I/O events. More...
 
void tasks_async_callback (struct ev_loop *loop, ev_async *w, int events)
 Callback for async events. More...
 
static void handle_signal (struct ev_loop *, ev_signal *sig, int)
 

Typedef Documentation

typedef std::function<void(int)> tasks::signal_func_t

Definition at line 32 of file dispatcher.h.

typedef std::function<void(struct ev_loop*)> tasks::task_func_t

Function type for functors that get executed in the context of a worker thread. See worker::exec_in_worker_ctx(task_func_t f).

Definition at line 19 of file event_task.h.

Enumeration Type Documentation

enum tasks::tasks_error
strong
Enumerator
SOCKET_SOCKET 

Error on socket sys call.

SOCKET_SOCKOPT_NOSIGPIPE 

Error on setsockopt sys call.

SOCKET_SOCKOPT_REUSEADDR 

Error on setsockopt sys call.

SOCKET_FNCTL 

Error on fnctl sys call.

SOCKET_BIND 

Error on bind sys call.

SOCKET_CHMOD 

Error on chmod sys call (domain sockets)

SOCKET_LISTEN 

Error on listen sys call.

SOCKET_LISTEN_UDP 

Error when calling listen on a UDP socket.

SOCKET_ACCEPT 

Error on accept sys call.

SOCKET_CONNECT 

Error on connect sys call.

SOCKET_NOHOST 

Error when trying to connect to a host that can't be resolved.

SOCKET_WRITE 

Error on sendto sys call.

SOCKET_READ 

Error on recvfrom sys call.

SOCKET_NOCON 

Error when reading from a disconnected socket.

HTTP_NOT_IMPL 

Error on chunked encoding, that is not available yet.

HTTP_NO_CONTENT_LENGTH 

HTTP errors.

HTTP_INVALID_STATUS_CODE 
HTTP_INVALID_HEADER 
UWSGI_HEADER_ERROR 

UWSGI errors.

UWSGI_NOT_IMPL 
UWSGI_THRIFT_TRANSPORT 
UWSGI_THRIFT_HANDLER 
TERM_NO_DEVICE 

Term errors.

TERM_TCGETATTR 
TERM_TCSETATTR 
TERM_OPEN 
TERM_FCNTL 
TERM_CFSETOSPEED 
TERM_CFSETISPEED 
TERM_INVALID_PARITY 
TERM_INVALID_STOPBITS 
TERM_INVALID_MODE 
DISKIO_INVALID_EVENT 

Disk IO.

UNSET 

Definition at line 16 of file tasks_exception.h.

Function Documentation

void tasks::exec ( exec_task::func_t  f)

Execute code in a separate executor thread.

Execute code in a separate executor thread that does not block a worker thread. This can be useful to implement async interfaces using libraries that do not provide async interfaces.

Parameters
fThe functor to execute.

Definition at line 14 of file exec.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::exec ( exec_task::func_t  f,
task::finish_func_void_t  ff 
)

Execute code in a separate executor thread.

Execute code in a separate executor thread that does not block a worker thread. This can be useful to implement async interfaces using libraries that do not provide async interfaces.

Parameters
fThe functor to execute.
ffThe finish functor to be executed when f has been executed.

Definition at line 16 of file exec.cpp.

Here is the call graph for this function:

static void tasks::handle_signal ( struct ev_loop *  ,
ev_signal *  sig,
int   
)
static

Definition at line 280 of file dispatcher.cpp.

Here is the caller graph for this function:

void tasks::tasks_async_callback ( struct ev_loop *  loop,
ev_async *  w,
int  events 
)

Callback for async events.

Definition at line 106 of file worker.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename EV_t >
void tasks::tasks_event_callback ( struct ev_loop *  loop,
EV_t  w,
int  e 
)

Callback for I/O events.

Definition at line 241 of file worker.h.

Here is the call graph for this function:

const char * tasks::version ( )

Definition at line 14 of file version.cpp.