1 |
/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. |
/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. |
2 |
* |
* |
3 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
4 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
53 |
|
|
54 |
#include "libguile/iselect.h" |
#include "libguile/iselect.h" |
55 |
|
|
56 |
#ifdef GUILE_ISELECT |
#ifdef USE_COOP_THREADS |
57 |
|
|
58 |
#include "libguile/coop-threads.h" |
#include "libguile/coop-threads.h" |
59 |
|
|
623 |
#include "libguile/iselect.x" |
#include "libguile/iselect.x" |
624 |
} |
} |
625 |
|
|
|
#endif /* GUILE_ISELECT */ |
|
|
|
|
626 |
int |
int |
627 |
scm_internal_select (int nfds, |
scm_internal_select (int nfds, |
628 |
SELECT_TYPE *readfds, |
SELECT_TYPE *readfds, |
630 |
SELECT_TYPE *exceptfds, |
SELECT_TYPE *exceptfds, |
631 |
struct timeval *timeout) |
struct timeval *timeout) |
632 |
{ |
{ |
|
#ifndef GUILE_ISELECT |
|
|
int res = select (nfds, readfds, writefds, exceptfds, timeout); |
|
|
SCM_ASYNC_TICK; |
|
|
return res; |
|
|
#else /* GUILE_ISELECT */ |
|
633 |
struct timeval now; |
struct timeval now; |
634 |
coop_t *t, *curr = coop_global_curr; |
coop_t *t, *curr = coop_global_curr; |
635 |
|
|
684 |
SCM_ALLOW_INTS; |
SCM_ALLOW_INTS; |
685 |
SCM_ASYNC_TICK; |
SCM_ASYNC_TICK; |
686 |
return coop_global_curr->retval; |
return coop_global_curr->retval; |
|
#endif /* GUILE_ISELECT */ |
|
687 |
} |
} |
688 |
|
|
689 |
|
#else |
690 |
|
#ifdef USE_NULL_THREADS |
691 |
|
|
692 |
|
int |
693 |
|
scm_internal_select (int nfds, |
694 |
|
SELECT_TYPE *readfds, |
695 |
|
SELECT_TYPE *writefds, |
696 |
|
SELECT_TYPE *exceptfds, |
697 |
|
struct timeval *timeout) |
698 |
|
{ |
699 |
|
int res = select (nfds, readfds, writefds, exceptfds, timeout); |
700 |
|
SCM_ASYNC_TICK; |
701 |
|
return res; |
702 |
|
} |
703 |
|
|
704 |
|
void |
705 |
|
scm_init_iselect () |
706 |
|
{ |
707 |
|
#include "libguile/iselect.x" |
708 |
|
} |
709 |
|
|
710 |
|
#endif /* USE_NULL_THREADS */ |
711 |
|
#endif /* !USE_COOP_THREADS */ |
712 |
|
|
713 |
/* |
/* |
714 |
Local Variables: |
Local Variables: |
715 |
c-file-style: "gnu" |
c-file-style: "gnu" |