comparison src/lru_cache.sml @ 2288:98f96a976ede

Finish locking, but it's not yet tested rigorously.
author Ziv Scully <ziv@mit.edu>
date Fri, 13 Nov 2015 11:03:09 -0500
parents 0bdfec16a01d
children 78820fa8f5a7
comparison
equal deleted inserted replaced
2287:08203f93dbc3 2288:98f96a976ede
67 67
68 in 68 in
69 Print.box 69 Print.box
70 [string ("static uw_Sqlcache_Cache cacheStruct" ^ i ^ " = {"), 70 [string ("static uw_Sqlcache_Cache cacheStruct" ^ i ^ " = {"),
71 newline, 71 newline,
72 string " .lock = PTHREAD_RWLOCK_INITIALIZER,", 72 string " .lockIn = PTHREAD_RWLOCK_INITIALIZER,",
73 newline,
74 string " .lockOut = PTHREAD_RWLOCK_INITIALIZER,",
73 newline, 75 newline,
74 string " .table = NULL,", 76 string " .table = NULL,",
75 newline, 77 newline,
76 string (" .numKeys = " ^ Int.toString params ^ ","), 78 string (" .numKeys = " ^ Int.toString params ^ ","),
77 newline, 79 newline,
78 string " .timeInvalid = 0,", 80 string " .timeInvalid = 0,",
79 newline, 81 newline,
80 string " .timeNow = 0};", 82 string " .timeNow = 0};",
81 newline, 83 newline,
82 string ("static uw_Sqlcache_Cache *cache" ^ i ^ " = &cacheStruct" ^ i ^ ";"), 84 string ("static uw_Sqlcache_Cache *cache" ^ i ^ " = &cacheStruct" ^ i ^ ";"),
85 newline,
86 newline,
87
88 string ("static void uw_Sqlcache_rlock" ^ i ^ "(uw_context ctx) {"),
89 newline,
90 string (" uw_Sqlcache_rlock(ctx, cache" ^ i ^ ");"),
91 newline,
92 string "}",
93 newline,
94 newline,
95
96 string ("static void uw_Sqlcache_wlock" ^ i ^ "(uw_context ctx) {"),
97 newline,
98 string (" uw_Sqlcache_wlock(ctx, cache" ^ i ^ ");"),
99 newline,
100 string "}",
83 newline, 101 newline,
84 newline, 102 newline,
85 103
86 string ("static uw_Basis_string uw_Sqlcache_check" ^ i), 104 string ("static uw_Basis_string uw_Sqlcache_check" ^ i),
87 string ("(uw_context ctx" ^ typedArgs ^ ") {"), 105 string ("(uw_context ctx" ^ typedArgs ^ ") {"),