Clean-up async IO internal functions.

This commit is contained in:
Eric Pouech 2005-03-29 11:40:10 +00:00 committed by Alexandre Julliard
parent 580ded65e7
commit 7001d6ed34
5 changed files with 14 additions and 14 deletions

View File

@ -251,7 +251,8 @@ struct timeout_user
static struct list timeout_list = LIST_INIT(timeout_list); /* sorted timeouts list */
/* add a timeout user */
struct timeout_user *add_timeout_user( struct timeval *when, timeout_callback func, void *private )
struct timeout_user *add_timeout_user( const struct timeval *when, timeout_callback func,
void *private )
{
struct timeout_user *user;
struct list *ptr;
@ -987,12 +988,10 @@ void unlock_fd( struct fd *fd, file_pos_t start, file_pos_t count )
struct async
{
struct fd *fd;
struct thread *thread;
void *apc;
void *user;
void *sb;
struct timeval when;
struct timeout_user *timeout;
struct list entry;
};
@ -1022,14 +1021,13 @@ static void async_callback(void *private)
}
/* create an async on a given queue of a fd */
struct async *create_async(struct fd *fd, struct thread *thread, int timeout, struct list *queue,
struct async *create_async(struct thread *thread, int* timeout, struct list *queue,
void *io_apc, void *io_user, void* io_sb)
{
struct async *async = mem_alloc( sizeof(struct async) );
if (!async) return NULL;
async->fd = fd;
async->thread = (struct thread *)grab_object(thread);
async->apc = io_apc;
async->user = io_user;
@ -1039,9 +1037,11 @@ struct async *create_async(struct fd *fd, struct thread *thread, int timeout, st
if (timeout)
{
gettimeofday( &async->when, 0 );
add_timeout( &async->when, timeout );
async->timeout = add_timeout_user( &async->when, async_callback, async );
struct timeval when;
gettimeofday( &when, 0 );
add_timeout( &when, *timeout );
async->timeout = add_timeout_user( &when, async_callback, async );
}
else async->timeout = NULL;

View File

@ -296,7 +296,7 @@ static void file_queue_async( struct fd *fd, void *apc, void *user, void *iosb,
return;
}
if (!create_async( fd, current, 0, queue, apc, user, iosb ))
if (!create_async( current, 0, queue, apc, user, iosb ))
return;
/* Check if the new pending request can be served immediately */

View File

@ -79,12 +79,12 @@ struct timeout_user;
typedef void (*timeout_callback)( void *private );
extern struct timeout_user *add_timeout_user( struct timeval *when,
extern struct timeout_user *add_timeout_user( const struct timeval *when,
timeout_callback func, void *private );
extern void remove_timeout_user( struct timeout_user *user );
extern void add_timeout( struct timeval *when, int timeout );
/* return 1 if t1 is before t2 */
static inline int time_before( struct timeval *t1, struct timeval *t2 )
static inline int time_before( const struct timeval *t1, const struct timeval *t2 )
{
return ((t1->tv_sec < t2->tv_sec) ||
((t1->tv_sec == t2->tv_sec) && (t1->tv_usec < t2->tv_usec)));
@ -111,7 +111,7 @@ extern int is_serial_fd( struct fd *fd );
extern struct object *create_serial( struct fd *fd, unsigned int options );
/* async I/O functions */
extern struct async *create_async( struct fd *fd, struct thread *thread, int timeout,
extern struct async *create_async( struct thread *thread, int* timeout,
struct list *queue, void *, void *, void *);
extern void async_terminate_head( struct list *queue, int status );

View File

@ -267,7 +267,7 @@ static void serial_queue_async( struct fd *fd, void *apc, void *user, void *iosb
return;
}
if (!create_async( fd, current, timeout, queue, apc, user, iosb ))
if (!create_async( current, &timeout, queue, apc, user, iosb ))
return;
/* Check if the new pending request can be served immediately */

View File

@ -528,7 +528,7 @@ static void sock_queue_async( struct fd *fd, void *apc, void *user, void *iosb,
}
else
{
if (!create_async( fd, current, 0, queue, apc, user, iosb ))
if (!create_async( current, 0, queue, apc, user, iosb ))
return;
}