diff doc/dbg_interactive.py.sample @ 641:69d3579f6c6c 1.0.3-rc3

First version of dbg_interactive is complete
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 21 Dec 2010 10:29:46 +0900
parents 237cf6339546
children 5e5d8152c229
line wrap: on
line diff
--- a/doc/dbg_interactive.py.sample	Mon Dec 20 19:36:40 2010 +0900
+++ b/doc/dbg_interactive.py.sample	Tue Dec 21 10:29:46 2010 +0900
@@ -647,8 +647,10 @@
 ############# PEERS ############
 
 # Get the list of peers defined in the system 
-# (well, we are supposed actually to readlock fd_g_peers_rw before doing this, but it should be fine most of the time)
+# (we are supposed to readlock fd_g_peers_rw before accessing this list)
+cvar.fd_g_peers_rw.rdlock()
 peers = cvar.fd_g_peers.enum_as("struct peer_hdr *")
+cvar.fd_g_peers_rw.unlock()
 for p in peers:
    print "Peer:", p.info.pi_diamid
 
@@ -726,3 +728,23 @@
 fd_ep_dump(0, np.pi_endpoints)
 
 
+
+############# POSIX functions wrappers ############
+
+# The interface also provides wrappers around base POSIX 
+# synchronization functions:
+
+m = pthread_mutex_t()
+m.lock()
+m.unlock()
+
+c = pthread_cond_t()
+c.signal()
+c.broadcast()
+c.wait(m)
+c.timedwait(m, 5)  # it takes a relative time
+
+r = pthread_rwlock_t()
+r.rdlock()
+r.unlock()
+r.wrlock()
"Welcome to our mercurial repository"