introduced callback_job:

simple asynchronous method invocation
  use daemons thread pool for all threads
  proper cancellation and cleanups
  cancellation mechanism to dynamically unload multithreaded code
unified event_queue and scheduler => scheduler
unified job_queue and thread_pool => processor
removed job_type_t, not really needed
fixes here, there and everywhere
This commit is contained in:
Martin Willi
2007-06-11 10:57:19 +00:00
parent aca0317d92
commit 9fe1a1ca76
36 changed files with 1637 additions and 1809 deletions
+19 -29
View File
@@ -46,32 +46,6 @@ struct private_send_keepalive_job_t {
ike_sa_id_t *ike_sa_id;
};
/**
* Implements send_keepalive_job_t.get_type.
*/
static job_type_t get_type(private_send_keepalive_job_t *this)
{
return SEND_KEEPALIVE;
}
/**
* Implementation of job_t.execute.
*/
static status_t execute(private_send_keepalive_job_t *this)
{
ike_sa_t *ike_sa;
ike_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
this->ike_sa_id);
if (ike_sa == NULL)
{
return DESTROY_ME;
}
ike_sa->send_keepalive(ike_sa);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
return DESTROY_ME;
}
/**
* Implements job_t.destroy.
*/
@@ -81,6 +55,23 @@ static void destroy(private_send_keepalive_job_t *this)
free(this);
}
/**
* Implementation of job_t.execute.
*/
static void execute(private_send_keepalive_job_t *this)
{
ike_sa_t *ike_sa;
ike_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
this->ike_sa_id);
if (ike_sa)
{
ike_sa->send_keepalive(ike_sa);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
}
destroy(this);
}
/*
* Described in header
*/
@@ -89,9 +80,8 @@ send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id)
private_send_keepalive_job_t *this = malloc_thing(private_send_keepalive_job_t);
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
this->public.job_interface.execute = (status_t (*) (job_t *)) execute;
this->public.job_interface.execute = (void (*) (job_t *)) execute;
/* public functions */
this->public.destroy = (void (*)(send_keepalive_job_t *)) destroy;
@@ -99,5 +89,5 @@ send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id)
/* private variables */
this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
return &(this->public);
return &this->public;
}