ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/cfperl.h
(Generate patch)

Comparing deliantra/server/include/cfperl.h (file contents):
Revision 1.57 by root, Fri Feb 16 19:43:41 2007 UTC vs.
Revision 1.62 by root, Tue Apr 17 10:06:33 2007 UTC

136 F_DESTROYED = 0x01, 136 F_DESTROYED = 0x01,
137 F_DEBUG_TRACE = 0x02, 137 F_DEBUG_TRACE = 0x02,
138 }; 138 };
139 139
140 // object is delete'd after the refcount reaches 0 140 // object is delete'd after the refcount reaches 0
141 int ACC (RW, flags);
141 mutable int ACC (RW, refcnt); 142 mutable int ACC (RW, refcnt);
142 int ACC (RW, flags);
143 143
144 MTH void refcnt_inc () const { ++refcnt; } 144 MTH void refcnt_inc () const { ++refcnt; }
145 MTH void refcnt_dec () const { --refcnt; } 145 MTH void refcnt_dec () const { --refcnt; }
146 146
147 MTH int refcnt_cnt () const; 147 MTH int refcnt_cnt () const;
335 335
336 operator bool () { return !!av; } 336 operator bool () { return !!av; }
337}; 337};
338 338
339// compatibility support, should be removed when no longer needed 339// compatibility support, should be removed when no longer needed
340int fprintf (object_freezer &freezer, const char *format, ...); 340void fprintf (object_freezer &freezer, const char *format, ...);
341int fputs (const char *s, object_freezer &freezer); 341void fputs (const char *s, object_freezer &freezer);
342 342
343struct object_thawer 343struct object_thawer
344{ 344{
345 SV *text; // text part 345 SV *text; // text part
346 AV *av; // perl part 346 AV *av; // perl part
369 { 369 {
370 next (); 370 next ();
371 return kw; 371 return kw;
372 } 372 }
373 373
374
375 char *get_str () { return value; } // may be 0 374 char *get_str () { return value; } // may be 0
376 375
377 void get (shstr &sh) const; 376 void get (shstr &sh) const;
378 void get_ornull (shstr &sh) const { sh = value; } 377 void get_ornull (shstr &sh) const { sh = value; }
379 void get_ml (keyword kend, shstr &sh); 378 void get_ml (keyword kend, shstr &sh);
407 static struct CoroAPI *GCoroAPI; 406 static struct CoroAPI *GCoroAPI;
408 407
409 static int nready () { return CORO_NREADY; } 408 static int nready () { return CORO_NREADY; }
410 static int cede () { return CORO_CEDE ; } 409 static int cede () { return CORO_CEDE ; }
411 410
411 static double (*time)();
412 static double next_cede;
412 static int cede_counter; 413 static int cede_counter;
413 414
415 static void do_cede_every ();
416 static void do_cede_to_tick ();
417 static void do_cede_to_tick_every ();
418
414 static void cede_every (int count) 419 static void cede_every (int count)
415 { 420 {
416 if (++cede_counter >= count) 421 if (++cede_counter >= count)
417 { 422 do_cede_every ();
418 cede_counter = 0;
419
420 if (coroapi::nready ())
421 coroapi::cede ();
422 }
423 } 423 }
424
425 static void cede_to_tick ()
426 {
427 if (time () >= next_cede)
428 do_cede_to_tick ();
429 }
430
431 static void cede_to_tick_every (int count)
432 {
433 if (++cede_counter >= count)
434 cede_to_tick ();
435 }
436
437 static void wait_for_tick ();
438 static void wait_for_tick_begin ();
424}; 439};
425 440
426struct watcher_base 441struct watcher_base
427{ 442{
428 static struct EventAPI *GEventAPI; 443 static struct EventAPI *GEventAPI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines