From owner-svn-src-all@FreeBSD.ORG Sat Jul 9 14:41:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05819106564A; Sat, 9 Jul 2011 14:41:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA5558FC17; Sat, 9 Jul 2011 14:41:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p69EfSeX004404; Sat, 9 Jul 2011 14:41:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p69EfSSI004402; Sat, 9 Jul 2011 14:41:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201107091441.p69EfSSI004402@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jul 2011 14:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223886 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2011 14:41:29 -0000 Author: kib Date: Sat Jul 9 14:41:28 2011 New Revision: 223886 URL: http://svn.freebsd.org/changeset/base/223886 Log: Implement a helper functions to locally set thread-private flag, and restore it to the previous state. Note that only setting a flag locally is supported. Sponsored by: The FreeBSD Foundation Reviewed by: alc (previous version) MFC after: 1 week Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Jul 9 14:30:13 2011 (r223885) +++ head/sys/sys/proc.h Sat Jul 9 14:41:28 2011 (r223886) @@ -913,6 +913,25 @@ void thread_unthread(struct thread *td); void thread_wait(struct proc *p); struct thread *thread_find(struct proc *p, lwpid_t tid); +static __inline int +thread_pflags_set(int flags) +{ + struct thread *td; + int save; + + td = curthread; + save = ~flags | (td->td_pflags & flags); + td->td_pflags |= flags; + return (save); +} + +static __inline void +thread_pflags_restore(int save) +{ + + curthread->td_pflags &= save; +} + #endif /* _KERNEL */ #endif /* !_SYS_PROC_H_ */