Simple tools for multi threading / objects in plain C Snapshot
Classes | Typedefs | Functions
RUNNABLE

an interface to run a unit of work. More...

Classes

struct  tagRUNNABLE

Typedefs

typedef struct tagRUNNABLE RUNNABLE

Functions

void RUNNABLE_init (RUNNABLE *runnable, RUNNABLE_HANDLER handler, RUNNABLE_HANDLER free_request)
 constructs a RUNNABLE instance
void RUNNABLE_free (RUNNABLE *runnable)
 free a RUNNABLE instance

Detailed Description

an interface to run a unit of work.

Acts as a work request for thread pool Includes a callback that is invoked in order to process the request.

Very similar to java concept of java.lang.Runnable.


Typedef Documentation

typedef struct tagRUNNABLE RUNNABLE

Function Documentation

void RUNNABLE_free ( RUNNABLE runnable)

free a RUNNABLE instance

Definition at line 15 of file tpool.c.

{
  if (runnable->free_request) {
    runnable->free_request( runnable );
  }
  free( runnable );
}
void RUNNABLE_init ( RUNNABLE runnable,
RUNNABLE_HANDLER  handler,
RUNNABLE_HANDLER  free_request 
)

constructs a RUNNABLE instance

Definition at line 8 of file tpool.c.

{
   runnable->handle_request = handler;
   runnable->free_request = free_request;  
}