Main Page   File List   File Members   Related Pages  

frdi_net_listener.c File Reference

the listener object More...

#include "frdi.h"

Functions

frdi_listener * frdiListenerNew (frdi_app *self, frdi_handler *spawner, int port_number)
void frdiSpawnedThreadRun (frdi_connection *connection)
void frdiListenerAccept (frdi_listener *listener)
void frdiListenerThreadRun (frdi_listener *listener)
void frdiListenerThreadLaunch (frdi_listener *listener)
void frdiListenerStart (frdi_listener *listener)
void frdiListenerStop (frdi_listener *listener)
void frdListenerFree (frdi_listener *listener)


Detailed Description

the listener object

Author:
Douglas Reay <douglas-legal@reay.org>
Warning:
THREAD CREATION PATTERN

Any time a new thread is created there will be a triplet of functions, most likely (but not necessarily) with names of the form:

The Launch and Run functions will have exactly the same semantics. However, the basis of the pattern is that the running code that wants to create a new thread in which to run frdiFooThreadRun does not itself use the pthread library. Instead it calls a typed Launch function. The purpose of this is to hide, from whatever calls the Run function the exact mechanism used to create the thread, thus allowing it in future to be changed with minimal disruption to the code. Also, the additional typing makes clear what the void *ptr actually is.


Function Documentation

frdi_listener* frdiListenerNew frdi_app *    self,
frdi_handler *    spawner,
int    port_number
 

create a new listener object

void frdiSpawnedThreadRun frdi_connection *    connection
 

hand of the newly spawned connection to the registered handler (See THREAD CREATION PATTERN)

void frdiListenerAccept frdi_listener *    listener
 

Accept new connections

void frdiListenerThreadRun frdi_listener *    listener
 

keep listening (See THREAD CREATION PATTERN)

void frdiListenerThreadLaunch frdi_listener *    listener
 

start seperate thread to keep listening (See THREAD CREATION PATTERN)

void frdiListenerStart frdi_listener *    listener
 

start listening

void frdiListenerStop frdi_listener *    listener
 

stop listening

void frdListenerFree frdi_listener *    listener
 

free up memory


Generated on Wed Aug 18 13:24:03 2004 for Project Fairdice by doxygen1.2.18