svn commit: r223886 - head/sys/sys
Konstantin Belousov
kib at FreeBSD.org
Sat Jul 9 14:41:29 UTC 2011
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_ */
More information about the svn-src-all
mailing list