Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6233847rdb; Thu, 14 Dec 2023 11:58:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBJrI6oFmW+YQSeuxOQa1F3t8h930Et3xusGnWQnh1REu5qH96aE0IJMviJV+w5edfM2EE X-Received: by 2002:a05:620a:2951:b0:77e:fbba:644e with SMTP id n17-20020a05620a295100b0077efbba644emr18570093qkp.45.1702583938126; Thu, 14 Dec 2023 11:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702583938; cv=none; d=google.com; s=arc-20160816; b=K088/1pLgjp4yId6wyMDZHLY2Rg6t8qt/dcRpH/eXIQe3ajUprxYGz95hPycojPTvH xyzPoyxWi0SOZdUjYZo9DvcTfd48iQ+Sj3BNsGlYJpaxCdYt6Q3W1jvQQ72NUgLIYL+a 12iH3pxykelV9wjcJ0ywqnGrDv/wcEQH39uYaL+OCJnEFA9Z+vOO8NKNnWY1Tj18XaJ6 q6PXiwFVFV777epkEp8TBhT92ga6pSDv/GBaU4+66QrCL2529e6yz9rGONCERQev8Uwp GDQxbf0d8/LfTkri/9zgq2Dobcg/GRRKQOAnVOiHdaixy99PgHYLIOzsi/BIR7QX97C9 7UgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=1t6WW6PWMVyvCR814CfeWvXobbx/+dvid0mhpQK6M3k=; fh=S5pb9DrM4IVRfD6koXKsg8SrnImBBNQBB+DepozucqM=; b=R6VIYFFRWyS9PKWjz41cHXCTI6/B/elBTuhlwlx90f5xvcS53ON0FgWqIFhj6cn92C sSDlEDJ+GABT1RfRjuy5f0ltDjAFYXYFqjq5lGJSfLzGDJE60/HZfoQOgfs8uNppS7kK TswqGAQSmON1whZaKgejThEC+wzCXWEVZoBPzJ0byBAuxhcyIMIIDxOtKODbJY8ZMORe 7kHbzmPyBM/L5tbVNQC9z74GzExphWkXtnLyjnHFgzEFKlhp83IWuLlq+3VQM7gkuGY9 W1Gc9jjCFCHgx/DYZPYZCKH/9r5XRtGl3l/Ol1XizBwgwmUW++bcybaNjZiMsJl9qYSP 0KQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cVs72TxT; spf=pass (google.com: domain of linux-kernel+bounces-46-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ea2-20020a05620a488200b0077429d89227si16576868qkb.375.2023.12.14.11.58.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 11:58:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cVs72TxT; spf=pass (google.com: domain of linux-kernel+bounces-46-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DEC791C21AAF for ; Thu, 14 Dec 2023 19:58:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE0856A024; Thu, 14 Dec 2023 19:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cVs72TxT" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 642CC6A008; Thu, 14 Dec 2023 19:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-77f43042268so80927085a.1; Thu, 14 Dec 2023 11:58:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702583925; x=1703188725; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=1t6WW6PWMVyvCR814CfeWvXobbx/+dvid0mhpQK6M3k=; b=cVs72TxT0B/I3Evlyi2DnSId2EDSvCWk1rRxZmTW1oTEcJzgwpJgoyOWBuGgS5EoHS M1VjfFaSDu4ordfWLGwjH+ZSJb1BlWVUck13Si7mWj3fQcgV/zuhnU9iehAd76pFQz6f mjq6dVNucIw+Nz9X4yQdR2SGb0DAPhHzGExXu+5xgNH7J6nltbLwgqdog7lL1Gf4ufgk bF0e+1xVkzuVUYPWlZi1nhSQlv7/cKS99sebhNJMBgLzU9ToT2L+QwbcdqzBM/DkQgMu w5ZH2HDua+udLMsOSfMjRzkfSlN1Tujqy5N+hw3ZTFzGvyx2W0l6+MkkwzCZpNNmKmD+ CWOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702583925; x=1703188725; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1t6WW6PWMVyvCR814CfeWvXobbx/+dvid0mhpQK6M3k=; b=LiT1ID+mIwSJ0oYvMSzvycYerHCWwW2ze6mXDtvGuL1uaYDLFyiVZ1dUFQUm+ZLjhH 3RuIq6urpkw2uMz4CwnA94CvNgxWOk6fV60M67+WbAWPslT4aQkZXrkOR4g3UGYtdQyD c79MZLwXTuQ19ZQ8PFmeN3fPNXpUZlNJq1xGrXRygjM3Z/2y/4IjODKvz2tbNMtubDyc dD3QRBDQVoiIF1OQcabuSW5r0swp4pr7Ah2szPJZ7jCuYrc8hO5GhBqzLhfOdWQp2nXe bwtKFXAqQ5x/fQR5Gb5/Z5ZK5RTZD3k2XW/+gbnTQ34jlwNONmBHyHkBJCwaqzDVz8N1 mi5g== X-Gm-Message-State: AOJu0YweLuXDtdo+dYGh6pwQ9oFr/Z9wlJWtI5pIBC2VddgKpYqBByfK LwqWyCNvVzMo8UkmyrhTIOo= X-Received: by 2002:a05:620a:2ed:b0:77f:8b0d:3b3f with SMTP id a13-20020a05620a02ed00b0077f8b0d3b3fmr6139187qko.42.1702583925179; Thu, 14 Dec 2023 11:58:45 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id p27-20020a05620a057b00b0077a029b7bf1sm5539453qkp.28.2023.12.14.11.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 11:58:44 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 4BFDE27C0054; Thu, 14 Dec 2023 14:58:44 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 14 Dec 2023 14:58:44 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudelledgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhephedugfduffffteeutddvheeuveelvdfhleelieevtdeguefhgeeuveei udffiedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Dec 2023 14:58:43 -0500 (EST) Date: Thu, 14 Dec 2023 11:58:38 -0800 From: Boqun Feng To: Alice Ryhl Cc: Tiago Lam , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] rust: sync: add `CondVar::wait_timeout` Message-ID: References: <20231206-rb-new-condvar-methods-v1-0-33a4cab7fdaa@google.com> <20231206-rb-new-condvar-methods-v1-2-33a4cab7fdaa@google.com> <1dd1a3e8-ef9a-4e89-891f-b49d82acc5f8@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Dec 08, 2023 at 08:37:27AM +0100, Alice Ryhl wrote: [...] > > > + /// Releases the lock and waits for a notification in interruptible mode. > > > + /// > > > + /// Atomically releases the given lock (whose ownership is proven by the guard) and puts the > > > + /// thread to sleep. It wakes up when notified by [`CondVar::notify_one`] or > > > + /// [`CondVar::notify_all`], or when a timeout occurs, or when the thread receives a signal. > > > + /// > > > + /// Returns whether there is a signal pending. > > > + #[must_use = "wait_timeout returns if a signal is pending, so the caller must check the return value"] > > > + pub fn wait_timeout( > > > + &self, > > > + guard: &mut Guard<'_, T, B>, > > > + jiffies: u64, > > > + ) -> CondVarTimeoutResult { > > > > Should this be called `wait_timeout_interruptable` instead, so that if > > we need to add one using the `TASK_INTERRUPTIBLE` state later we don't > > need to modfy it again? It also matches the > > `schedule_timeout_interruptible` one in the kernel (although that's not > > a reason to change it just in itself). > > I don't mind changing the names, but in this patch I was just > consistent with what was already there. > Hmm.. so Rust's wait() is actually interruptible wait and we have wait_uninterruptible(), while C API is wait_event() is uninterruptible, and we have a wait_event_interruptible(), I think it makes sense we follow what C API has. Will send a patch soon. Regards, Boqun [...]