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.56 by root, Thu Feb 15 21:07:49 2007 UTC vs.
Revision 1.63 by root, Mon Apr 23 18:09:57 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;
205 205
206extern struct global gbl_ev; 206extern struct global gbl_ev;
207 207
208////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 208//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
209 209
210struct object_freezer : dynbuf 210struct object_freezer : dynbuf_text
211{ 211{
212 AV *av; 212 AV *av;
213 213
214 object_freezer (); 214 object_freezer ();
215 ~object_freezer (); 215 ~object_freezer ();
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
357 ~object_thawer (); 357 ~object_thawer ();
358 358
359 void get (attachable *obj, int oid); 359 void get (attachable *obj, int oid);
360 360
361 // parse next line 361 // parse next line
362 void next_kv (); 362 void next ();
363 //TODO: remove
364 keyword get_kv ()
365 {
366 next_kv ();
367 return kw;
368 }
369
370 // skip the current key-value (usually fetch next line, for 363 // skip the current key-value (usually fetch next line, for
371 // multiline-fields, skips untilt he corresponding end-kw 364 // multiline-fields, skips untilt he corresponding end-kw
372 void skip_kv (); 365 void skip ();
373 366
367 //TODO: remove, deprecated
368 keyword get_kv ()
369 {
370 next ();
371 return kw;
372 }
373
374 const char *get_str () { return value; } // may be 0 374 char *get_str () { return value; } // may be 0
375 375
376 void get (shstr &sh) const; 376 void get (shstr &sh) const;
377 void get_ornull (shstr &sh) const { sh = value; } 377 void get_ornull (shstr &sh) const { sh = value; }
378 void get_ml (keyword kend, shstr &sh); 378 void get_ml (keyword kend, shstr &sh);
379 379
406 static struct CoroAPI *GCoroAPI; 406 static struct CoroAPI *GCoroAPI;
407 407
408 static int nready () { return CORO_NREADY; } 408 static int nready () { return CORO_NREADY; }
409 static int cede () { return CORO_CEDE ; } 409 static int cede () { return CORO_CEDE ; }
410 410
411 static double (*time)();
412 static double next_cede;
411 static int cede_counter; 413 static int cede_counter;
412 414
415 static void do_cede_every ();
416 static void do_cede_to_tick ();
417 static void do_cede_to_tick_every ();
418
413 static void cede_every (int count) 419 static void cede_every (int count)
414 { 420 {
415 if (++cede_counter >= count) 421 if (++cede_counter >= count)
416 { 422 do_cede_every ();
417 cede_counter = 0;
418
419 if (coroapi::nready ())
420 coroapi::cede ();
421 }
422 } 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 ();
423}; 439};
424 440
425struct watcher_base 441struct watcher_base
426{ 442{
427 static struct EventAPI *GEventAPI; 443 static struct EventAPI *GEventAPI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines