Hi Willi,
please don't inline patches because it's too difficult to extract those...
as to this patch, I'm +1 but please send it as attachment and fix indents.
Wilfried Goesgens wrote:
> to get to know whether you where woken up from sleep,
> or the sleep endet naturaly, the following patch is needed:
>
> (i need this, to determine, whether i was woken up from a thread
> doing tcdrain, or if the tcdrain system call gets stuck. the
> systemcall doesn't provide the ability of a timeout.)
>
> no funtionality change, just documentation and actually
> do return ret.
>
> to header:
>
> gwlib/gwthread.h 2005-04-13 18:13:38.000000000 +0200
> +++ gwthread.h 2005-04-13 19:47:39.000000000 +0200
> @@ -139,8 +139,12 @@ int gwthread_pollfd(int fd, int events,
> int gwthread_poll(struct pollfd *fds, long numfds, double timeout);
>
> /* Sleep until "seconds" seconds have elapsed, or until another thread
> - * calls gwthread_wakeup on us. Fractional seconds are allowed. */
> -void gwthread_sleep(double seconds);
> + * calls gwthread_wakeup on us. Fractional seconds are allowed.
> + * as we need the return of poll, get it here.
> + * returns 0 on Timeout, positive value if the thread was
> + * awakened by another thread. -1 on error.
> + */
> +int gwthread_sleep(double seconds);
>
> /*
> * Check wheather this thread should handle the given signal.
>
>
>
> to code:
>
> gwlib/gwthread-pthread.c 2005-04-13 18:13:38.000000000 +0200
> +++ gwthread-pthread.c 2005-04-13 19:50:13.000000000 +0200
> @@ -730,7 +730,7 @@ int gwthread_poll(struct pollfd *fds, lo
> }
>
>
> -void gwthread_sleep(double seconds)
> +int gwthread_sleep(double seconds)
> {
> struct pollfd pollfd;
> struct threadinfo *threadinfo;
> @@ -755,6 +755,7 @@ void gwthread_sleep(double seconds)
> if (ret == 1) {
> flushpipe(pollfd.fd);
> }
> + return ret;
> }
--
Thanks,
Alex