struct pollfd *fds = internal->fds;
SilcUInt32 fds_count = internal->fds_count;
int fd, ret, i = 0, timeout = -1;
+ void *fdp;
silc_hash_table_list(schedule->fd_queue, &htl);
- while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+ while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
if (!task->events)
continue;
+ fd = SILC_PTR_TO_32(fdp);
/* Allocate larger fd table if needed */
if (i >= fds_count) {
SilcTaskFd task;
fd_set in, out;
int fd, max_fd = 0, ret;
+ void *fdp;
FD_ZERO(&in);
FD_ZERO(&out);
silc_hash_table_list(schedule->fd_queue, &htl);
- while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+ while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
if (!task->events)
continue;
+ fd = SILC_PTR_TO_32(fdp);
#ifdef FD_SETSIZE
if (fd >= FD_SETSIZE)
return ret;
silc_hash_table_list(schedule->fd_queue, &htl);
- while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+ while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
if (!task->header.valid || !task->events)
continue;
+ fd = SILC_PTR_TO_32(fdp);
#ifdef FD_SETSIZE
if (fd >= FD_SETSIZE)
SilcUnixScheduler internal;
int i;
- internal = silc_calloc(1, sizeof(*internal));
+ internal = silc_scalloc(schedule->stack, 1, sizeof(*internal));
if (!internal)
return NULL;
#ifdef SILC_THREADS
if (pipe(internal->wakeup_pipe)) {
SILC_LOG_ERROR(("pipe() fails: %s", strerror(errno)));
- silc_free(internal);
return NULL;
}
#elif defined(HAVE_POLL) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
silc_free(internal->fds);
#endif /* HAVE_POLL && HAVE_SETRLIMIT && RLIMIT_NOFILE */
-
- silc_free(internal);
}
/* Wakes up the scheduler */
signal_call[i].sig = sig;
signal_call[i].callback = callback;
signal_call[i].context = callback_context;
+ signal_call[i].schedule = schedule;
signal_call[i].call = FALSE;
signal(sig, silc_schedule_internal_sighandler);
break;
signal_call[i].sig = 0;
signal_call[i].callback = NULL;
signal_call[i].context = NULL;
+ signal_call[i].schedule = NULL;
signal_call[i].call = FALSE;
signal(sig, SIG_DFL);
}