--- pth_event.c 2002/01/27 13:15:28 1.58
+++ pth_event.c 2002/10/24 15:21:13 1.59
@@ -92,7 +92,7 @@
ev = (pth_event_t)malloc(sizeof(struct pth_event_st));
}
if (ev == NULL)
- return NULL; /* errno is already set */
+ return pth_error((pth_event_t)NULL, errno);
/* create new event ring out of event or insert into existing ring */
if (spec & PTH_MODE_CHAIN) {
@@ -115,7 +115,7 @@
/* filedescriptor event */
int fd = va_arg(ap, int);
if (!pth_util_fd_valid(fd))
- return_errno(NULL, EBADF);
+ return pth_error((pth_event_t)NULL, EBADF);
ev->ev_type = PTH_EVENT_FD;
ev->ev_goal = (int)(spec & (PTH_UNTIL_FD_READABLE|\
PTH_UNTIL_FD_WRITEABLE|\
@@ -201,7 +201,7 @@
ev->ev_args.FUNC.tv = va_arg(ap, pth_time_t);
}
else
- return_errno(NULL, EINVAL);
+ return pth_error((pth_event_t)NULL, EINVAL);
va_end(ap);
@@ -213,7 +213,7 @@
unsigned long pth_event_typeof(pth_event_t ev)
{
if (ev == NULL)
- return_errno(0, EINVAL);
+ return pth_error(0, EINVAL);
return (ev->ev_type | ev->ev_goal);
}
@@ -223,7 +223,7 @@
va_list ap;
if (ev == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
va_start(ap, ev);
/* extract event specific ingredients */
@@ -274,7 +274,7 @@
*tv = ev->ev_args.FUNC.tv;
}
else
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
va_end(ap);
return TRUE;
}
@@ -289,7 +289,7 @@
va_list ap;
if (evf == NULL)
- return_errno(NULL, EINVAL);
+ return pth_error((pth_event_t)NULL, EINVAL);
/* open ring */
va_start(ap, evf);
@@ -318,7 +318,7 @@
pth_event_t ring;
if (ev == NULL)
- return_errno(NULL, EINVAL);
+ return pth_error((pth_event_t)NULL, EINVAL);
ring = NULL;
if (!(ev->ev_next == ev && ev->ev_prev == ev)) {
ring = ev->ev_next;
@@ -334,7 +334,7 @@
int pth_event_occurred(pth_event_t ev)
{
if (ev == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
return ev->ev_occurred;
}
@@ -342,14 +342,14 @@
pth_event_t pth_event_walk(pth_event_t ev, unsigned int direction)
{
if (ev == NULL)
- return_errno(NULL, EINVAL);
+ return pth_error((pth_event_t)NULL, EINVAL);
do {
if (direction & PTH_WALK_NEXT)
ev = ev->ev_next;
else if (direction & PTH_WALK_PREV)
ev = ev->ev_prev;
else
- return_errno(NULL, EINVAL);
+ return pth_error((pth_event_t)NULL, EINVAL);
} while ((direction & PTH_UNTIL_OCCURRED) && !(ev->ev_occurred));
return ev;
}
@@ -361,7 +361,7 @@
pth_event_t evn;
if (ev == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (mode == PTH_FREE_THIS) {
ev->ev_prev->ev_next = ev->ev_next;
ev->ev_next->ev_prev = ev->ev_prev;
@@ -386,7 +386,7 @@
/* at least a waiting ring is required */
if (ev_ring == NULL)
- return_errno(-1, EINVAL);
+ return pth_error(-1, EINVAL);
pth_debug2("pth_wait: enter from thread \"%s\"", pth_current->name);
/* mark all events in waiting ring as still not occurred */
|