Skip site navigation (1)Skip section navigation (2)
Date:      28 Mar 1998 15:38:59 +0200
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        dg@root.com
Cc:        "Viren R. Shah" <viren@rstcorp.com>, freebsd-chat@FreeBSD.ORG
Subject:   Re: wcarchive user limit
Message-ID:  <p1i3eg3q6ix.fsf@panke.panke.de>
In-Reply-To: David Greenman's message of Fri, 27 Mar 1998 12:42:50 -0800
References:  <199803272042.MAA07670@implode.root.com>

next in thread | previous in thread | raw e-mail | index | archive | help
David Greenman <dg@root.com> writes:
> >Logged in to ftp.freebsd.org. 
> >Welcome to wcarchive - home ftp site for Walnut Creek CDROM.
> >There are currently 3001 users out of 3000 possible.
> >---
> >
> >Hmm..off-by-one error? or a race condition?
> 
>    Race condition - a context switch occured at just the wrong time and this
> allowed an extra user in when it shouldn't have. I could add locking around
> the check/increment of the user count, but why bother?

You could also lie and claim he is user 3000 (instead 3001).

	maxuser = 3000;
	printf("There are currently %d users out of %d possible.", 
		(user < maxuser ? user : maxuser), maxuser);

-- 
Wolfram Schneider   <wosch@freebsd.org>   http://www.freebsd.org/~wosch/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p1i3eg3q6ix.fsf>