This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A micro event loop library implementation from scratch. | |
This library provides a minimal but feature-complete asynchronous event loop | |
implementation for educational purposes. It demonstrates the core concepts of | |
asynchronous programming including: | |
- Task scheduling and management | |
- I/O multiplexing with non-blocking sockets | |
- Timeouts and sleep functionality |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var%20b64pad='';var%20chrsz=8;function%20b64_sha1(s)%7Breturn%20binb2b64(core_sha1(str2binb(s),s.length*chrsz));%7Dfunction%20core_sha1(x,len)%7Bx%5Blen%3E%3E5%5D%7C=0x80%3C%3C(24-len);x%5B((len+64%3E%3E9)%3C%3C4)+15%5D=len;var%20w=Array(80);var%20a=1732584193;var%20b=-271733879;var%20c=-1732584194;var%20d=271733878;var%20e=-1009589776;for(var%20i=0;i%3Cx.length;i+=16)%7Bvar%20olda=a;var%20oldb=b;var%20oldc=c;var%20oldd=d;var%20olde=e;for(var%20j=0;j%3C80;j++)%7Bif(j%3C16)w%5Bj%5D=x%5Bi+j%5D;else%20w%5Bj%5D=rol(w%5Bj-3%5D%5Ew%5Bj-8%5D%5Ew%5Bj-14%5D%5Ew%5Bj-16%5D,1);var%20t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w%5Bj%5D),sha1_kt(j)));e=d;d=c;c=rol(b,30);b=a;a=t;%7Da=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);e=safe_add(e,olde);%7Dreturn%20Array(a,b,c,d,e);%7Dfunction%20sha1_ft(t,b,c,d)%7Bif(t%3C20)return%20(b&c)%7C((~b)&d);if(t%3C40)return%20b%5Ec%5Ed;if(t%3C60)return%20(b&c)%7C(b&d)%7C(c&d);return%20b%5Ec%5Ed;%7Dfunction%20sha1_kt(t)%7Bretur |