From owner-freebsd-hackers Fri Oct 11 6:16:56 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3564D37B401 for ; Fri, 11 Oct 2002 06:16:54 -0700 (PDT) Received: from mail.empirequest.com (www.empirequest.com [216.126.10.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7002343E9E for ; Fri, 11 Oct 2002 06:16:53 -0700 (PDT) (envelope-from spinlock_lists@empirequest.com) Received: (qmail 26609 invoked by uid 89); 11 Oct 2002 13:16:53 -0000 Received: from unknown (HELO fivehundred) (spinlock?lists@empirequest.com@192.168.0.3) by www.empirequest.com with SMTP; 11 Oct 2002 13:16:53 -0000 Message-ID: <004e01c27128$77828c30$0300a8c0@fivehundred> From: "Andrei Cojocaru" To: "Peter Pentchev" Cc: References: <000d01c270c8$937a2160$0200a8c0@twothousand> <20021011110508.GR376@straylight.oblivion.bg> <20021011110640.GS376@straylight.oblivion.bg> Subject: Re: Question about light-weight mutex (kind of) Date: Fri, 11 Oct 2002 07:16:53 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Ah, no. I am writing my own R/W lock because I need the ability to offload them = to disk. I think condition variables should be fast enough for what I'm = looking for. Any ideas? ----- Original Message -----=20 From: "Peter Pentchev" To: "Andrei Cojocaru" Cc: Sent: Friday, October 11, 2002 05:06 Subject: Re: Question about light-weight mutex (kind of) On Fri, Oct 11, 2002 at 02:05:08PM +0300, Peter Pentchev wrote: > On Thu, Oct 10, 2002 at 07:50:28PM -0600, Andrei Cojocaru wrote: > > Hello, > >=20 > > I have a question, please include me in the reply specifically = because I'm > > not subscribed to the mailing list. Thanks > >=20 > > I want a thread to spin atomically on a value until it's equal to = 1(i.e. > > it's waiting for an event), how do I do that? I have no idea.. I = want this > > to be fast, not have to use a mutex each time to protect the value > > I have an idea of how to do it using atomic assembly statements but = I don't > > want to use assmebly, I want to know if FreeBSD has built-in stuff = for this. > >=20 > > Please help thanks. > >=20 > > This is required because I'm building R/W locks for a transaction = system I'm > > working on, and I need a way for a thread waiting on a lock to be = notified > > when a lock is gotten (and without having the thread block [that's = why I > > want it to spin]). Any hints would be appreciated thanks, once = again. >=20 > Would pthread_rwlock_tryrdlock(3) and pthread_rwlock_tryrdlock(3), > combined with an usleep() or something, do the trick? Of course, the second one was meant to be pthread_rwlock_trywrlock(3)... G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 Hey, out there - is it *you* reading me, or is it someone else? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message