[GanamePage: Added checks that only one request will be handled concurrently flux@modeemi.fi**20090924200039] { hunk ./ganameDemo.ml 5 -let page (cgi : Netcgi.cgi) = - cgi#set_header - ~cache:`No_cache - ~content_type:"text/html; charset=iso-8859-15" - (); +let operations = ref 0 +let operations_lock = Mutex.create () + +let incr_operations_if_zero () = + Mutex.lock operations_lock; + let success = + if !operations = 0 then + ( incr operations; + true ) + else + false + in + Mutex.unlock operations_lock; + success + +let decr_operations () = + Mutex.lock operations_lock; + decr operations; + Mutex.unlock operations_lock + +let operation_page (cgi : Netcgi.cgi) = hunk ./ganameDemo.ml 48 -let main () = Netcgi_scgi.run ~port:4243 page +let busy_page (cgi : Netcgi.cgi) = + cgi#out_channel#output_string "