Date: Sat, 9 Jul 2011 14:41:28 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223886 - head/sys/sys Message-ID: <201107091441.p69EfSSI004402@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107091441.p69EfSSI004402>