This looks like the "reactor" pattern.
#include "sofia-sip/su_wait.h"
#include "su_module_debug.h"
#include <sofia-sip/su_alloc.h>
#include <assert.h>
#include <pthread.h>
Include dependency graph for su_port.h:
Go to the source code of this file.
Data Structures | |
struct | su_msg_s |
Message. More... | |
struct | su_root_t |
Root structure. More... | |
struct | su_port_vtable |
Virtual function table for port. More... | |
struct | su_base_port_s |
Base port object. More... | |
struct | su_pthread_port_s |
Pthread port object. More... | |
Typedefs | |
typedef su_port_vtable | su_port_vtable_t |
Virtual function table for port. | |
typedef su_base_port_s | su_base_port_t |
Base port object. | |
typedef su_pthread_port_s | su_pthread_port_t |
Pthread port object. | |
Functions | |
su_port_t * | su_port_create (void)) |
Create the preferred su_port_t implementation. | |
void | su_msg_delivery_report (su_msg_r msg) |
Send a delivery report. | |
su_duration_t | su_timer_next_expires (su_timer_t const *t, su_time_t now) |
Calculate duration in milliseconds until next timer expires. | |
char const * | su_port_name (su_port_t const *port) |
Return name of the su_port_t instance. | |
int | su_pthreaded_port_start (su_port_create_f *create, su_root_t *parent, su_clone_r return_clone, su_root_magic_t *magic, su_root_init_f init, su_root_deinit_f deinit) |
Start a clone task running under a pthread. | |
void | su_pthread_port_wait (su_clone_r rclone) |
Wait for the pthread clone to exit. | |
int | su_pthread_port_execute (su_task_r const task, int(*function)(void *), void *arg, int *return_value) |
Execute the function by a pthread task. |
typedef struct su_base_port_s su_base_port_t |
Base port object.
Port is a per-thread reactor. Multiple root objects executed by a single thread share the su_port_t object.
void su_msg_delivery_report | ( | su_msg_r | msg | ) |
Send a delivery report.
If the sender has attached a delivery report function to message with su_msg_report(), the message is returned to the message queue of the sending task. The sending task calls the delivery report function when it has received the message.
su_port_t* su_port_create | ( | void | ) |
Create the preferred su_port_t implementation.
char const* su_port_name | ( | su_port_t const * | port | ) |
Return name of the su_port_t instance.
int su_pthread_port_execute | ( | su_task_r const | task, | |
int(*)(void *) | function, | |||
void * | arg, | |||
int * | return_value | |||
) |
Execute the function by a pthread task.
0 | if successful | |
-1 | upon an error |
su_duration_t su_timer_next_expires | ( | su_timer_t const * | t, | |
su_time_t | now | |||
) |
Calculate duration in milliseconds until next timer expires.