comparison runtime/context.c @ 142:7bbdc034e347

Fix some bugs. Get basic network code working (epoll listener + accept connections). Start porting webserver.
author Mike Pavone <pavone@retrodev.com>
date Sun, 21 Nov 2010 16:33:17 -0500
parents f2cb85c53ced
children ba35ab624ec2
comparison
equal deleted inserted replaced
141:f2cb85c53ced 142:7bbdc034e347
32 } 32 }
33 33
34 int32_t put_cqueue(context * ct) 34 int32_t put_cqueue(context * ct)
35 { 35 {
36 rh_lock(cq_lock); 36 rh_lock(cq_lock);
37 if ((cq_writeloc+1)&31 == cq_readloc) 37 if (((cq_writeloc+1)&31) == cq_readloc)
38 { 38 {
39 rh_unlock(cq_lock); 39 rh_unlock(cq_lock);
40 return 0; 40 return 0;
41 } 41 }
42 contextqueue[cq_writeloc++] = ct; 42 contextqueue[cq_writeloc++] = ct;
43 if(cq_writeloc == 32)
44 cq_writeloc = 0;
43 rh_unlock(cq_lock); 45 rh_unlock(cq_lock);
44 return 1; 46 return 1;
45 } 47 }
46 48
47 stackchunk * new_stack() 49 stackchunk * new_stack()