Changeset 7120
- Timestamp:
- 01/29/10 06:39:11 (7 months ago)
- Location:
- trunk/liquidsoap/src
- Files:
-
- 4 modified
-
sources/playlist.ml (modified) (3 diffs)
-
sources/request_source.ml (modified) (1 diff)
-
tools/tutils.ml (modified) (1 diff)
-
tools/tutils.mli (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/sources/playlist.ml
r7111 r7120 109 109 * Must be called within mylock critical section. *) 110 110 method randomize_playlist = 111 (* This assertion does not work on 112 * win32 because a thread can double-lock 113 * the same mutex.. *) 114 if Sys.os_type <> "Win32" then 115 assert (not (Mutex.try_lock mylock)) ; 111 assert (Tutils.seems_locked mylock) ; 116 112 Utils.randomize !playlist 117 113 … … 236 232 method reload_playlist_internal new_playlist_uri = 237 233 238 (* This assertion does not work on 239 * win32 because a thread can double-lock 240 * the same mutex.. *) 241 if Sys.os_type <> "Win32" then 242 assert (not (Mutex.try_lock reloading)) ; 234 assert (Tutils.seems_locked reloading) ; 243 235 244 236 self#load_playlist ?uri:new_playlist_uri true ; … … 256 248 method reload_update round_done = 257 249 (* Must be called by somebody who owns [mylock] *) 258 (* This assertion does not work on 259 * win32 because a thread can double-lock 260 * the same mutex.. *) 261 if Sys.os_type <> "Win32" then 262 assert (not (Mutex.try_lock mylock)) ; 250 assert (Tutils.seems_locked mylock) ; 263 251 match reload with 264 252 | Never -> () -
trunk/liquidsoap/src/sources/request_source.ml
r7111 r7120 69 69 * when there is no ready request. *) 70 70 method private begin_track = 71 (* This assertion does not work on 72 * win32 because a thread can double-lock 73 * the same mutex.. *) 74 if Sys.os_type <> "Win32" then 75 assert (not (Mutex.try_lock plock)) ; 71 assert (Tutils.seems_locked plock) ; 76 72 assert (current = None) ; 77 73 match self#get_next_file with -
trunk/liquidsoap/src/tools/tutils.ml
r6666 r7120 81 81 with 82 82 | e -> Mutex.unlock lock ; raise e 83 84 let seems_locked = 85 if Sys.os_type = "Win32" then (fun _ -> true) else 86 fun m -> 87 if Mutex.try_lock m then begin 88 Mutex.unlock m ; 89 false 90 end else 91 true 83 92 84 93 (** Manage a set of threads and make sure they terminate correctly, -
trunk/liquidsoap/src/tools/tutils.mli
r6344 r7120 63 63 (** Make a function work in critical section, protected by a given lock. *) 64 64 val mutexify : Mutex.t -> ('a -> 'b) -> ('a -> 'b) 65 66 (** Tests whether a mutex is locked, without blocking. 67 * We cannot check on Win32, where [true] is always returned: 68 * it always "seems" OK, we don't raise false alarms. 69 * This is meant to be used for assertions. *) 70 val seems_locked : Mutex.t -> bool
