diff options
author | fcolin | 2006-04-19 08:28:14 +0000 |
---|---|---|
committer | fcolin | 2006-04-19 08:28:14 +0000 |
commit | 6bf117656574521545694a1a4e5169755077631e (patch) | |
tree | f18c164c217e2279781a3af9851b644da97dfba1 /src/ivyloop.c | |
parent | ca9eddefaec96a20b88b9aba25a9384037317c91 (diff) | |
download | ivy-c-6bf117656574521545694a1a4e5169755077631e.zip ivy-c-6bf117656574521545694a1a4e5169755077631e.tar.gz ivy-c-6bf117656574521545694a1a4e5169755077631e.tar.bz2 ivy-c-6bf117656574521545694a1a4e5169755077631e.tar.xz |
correction de probleme potentiel en multithread ( Ada rejeu )
ajout d'un warning en cas de client bloquant si la varaiable d'env IVY_DEBUG_SEND est positionne
Diffstat (limited to 'src/ivyloop.c')
-rw-r--r-- | src/ivyloop.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ivyloop.c b/src/ivyloop.c index 9ccd427..cf121e3 100644 --- a/src/ivyloop.c +++ b/src/ivyloop.c @@ -98,17 +98,14 @@ Channel IvyChannelSetUp (HANDLE fd, void *data, { Channel channel; - IVY_LIST_ADD (channels_list, channel); - if (!channel) { - fprintf(stderr,"NOK Memory Alloc Error\n"); - exit(0); - } + IVY_LIST_ADD_START (channels_list, channel) channel->fd = fd; channel->tobedeleted = 0; channel->handle_delete = handle_delete; channel->handle_read = handle_read; channel->data = data; - + IVY_LIST_ADD_END (channels_list, channel) + FD_SET (channel->fd, &open_fds); return channel; @@ -165,7 +162,7 @@ void IvyStop (void) MainLoop = 0; } -void IvyMainLoop(void(*hook)(void)) +void IvyMainLoop(void(*BeforeSelect)(void),void(*AfterSelect)(void)) { fd_set rdset; @@ -174,10 +171,12 @@ void IvyMainLoop(void(*hook)(void)) while (MainLoop) { ChannelDefferedDelete(); - if (hook) (*hook)(); + if (BeforeSelect) (*BeforeSelect)(); rdset = open_fds; exset = open_fds; ready = select(64, &rdset, 0, &exset, TimerGetSmallestTimeout()); + if (AfterSelect) (*AfterSelect)(); + if (ready < 0 && (errno != EINTR)) { fprintf (stderr, "select error %d\n",errno); perror("select"); @@ -187,7 +186,6 @@ void IvyMainLoop(void(*hook)(void)) if (ready > 0) { IvyChannelHandleExcpt(&exset); IvyChannelHandleRead(&rdset); - continue; } } } |