svn commit: r294640 - stable/9/lib/libthr/thread

Eric van Gyzen vangyzen at FreeBSD.org
Sat Jan 23 20:51:58 UTC 2016


Author: vangyzen
Date: Sat Jan 23 20:51:57 2016
New Revision: 294640
URL: https://svnweb.freebsd.org/changeset/base/294640

Log:
  MFC r293858
  
  libthr: const-ify two variables
  
  Make the default umutex and urwlock initializers const,
  because they can be, and as a microoptimization.
  
  Sponsored by:   Dell Inc.

Modified:
  stable/9/lib/libthr/thread/thr_umtx.c
Directory Properties:
  stable/9/lib/libthr/   (props changed)

Modified: stable/9/lib/libthr/thread/thr_umtx.c
==============================================================================
--- stable/9/lib/libthr/thread/thr_umtx.c	Sat Jan 23 20:49:52 2016	(r294639)
+++ stable/9/lib/libthr/thread/thr_umtx.c	Sat Jan 23 20:51:57 2016	(r294640)
@@ -42,7 +42,7 @@ int _umtx_op_err(void *obj, int op, u_lo
 void
 _thr_umutex_init(struct umutex *mtx)
 {
-	static struct umutex default_mtx = DEFAULT_UMUTEX;
+	static const struct umutex default_mtx = DEFAULT_UMUTEX;
 
 	*mtx = default_mtx;
 }
@@ -50,7 +50,8 @@ _thr_umutex_init(struct umutex *mtx)
 void
 _thr_urwlock_init(struct urwlock *rwl)
 {
-	static struct urwlock default_rwl = DEFAULT_URWLOCK;
+	static const struct urwlock default_rwl = DEFAULT_URWLOCK;
+
 	*rwl = default_rwl;
 }
 


More information about the svn-src-stable-9 mailing list