~ubuntu-branches/ubuntu/gutsy/st/gutsy

« back to all changes in this revision

Viewing changes to common.h

  • Committer: Bazaar Package Importer
  • Author(s): Wesley W. Terpstra (Debian)
  • Date: 2007-01-14 21:36:45 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070114213645-34cpn8xpl92dp1lc
Tags: 1.7-1
* New upstream release (closes: #406394)
* Increased standards-version; no changes necessary
* Moved from DH_COMPAT level 2 to 5; no changes necessary
* Added linker options to indicate that an executable stack is not needed
* Downgraded optimization to -O2

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
  _st_thread_t *sleep_q;      /* sleep queue for this vp */
213
213
  int sleepq_size;            /* number of threads on sleep queue */
214
214
 
 
215
#ifdef ST_SWITCH_CB
 
216
  st_switch_cb_t switch_out_cb; /* called when a thread is switched out */
 
217
  st_switch_cb_t switch_in_cb;  /* called when a thread is switched in */
 
218
#endif
 
219
 
215
220
#ifndef USE_POLL
216
221
  int maxfd;
217
222
  fd_set fd_read_set, fd_write_set, fd_exception_set;
351
356
#else
352
357
#define ST_DEFAULT_STACK_SIZE (128*1024)  /* Includes register stack size */
353
358
#endif
 
359
 
 
360
#ifndef ST_KEYS_MAX
354
361
#define ST_KEYS_MAX 16
 
362
#endif
 
363
 
 
364
#ifndef ST_MIN_POLLFDS_SIZE
355
365
#define ST_MIN_POLLFDS_SIZE 64
 
366
#endif
356
367
 
357
368
 
358
369
/*****************************************
366
377
#define ST_DEBUG_ITERATE_THREADS()
367
378
#endif
368
379
 
 
380
#ifdef ST_SWITCH_CB
 
381
#define ST_SWITCH_OUT_CB(_thread)               \
 
382
    if (_st_this_vp.switch_out_cb != NULL &&    \
 
383
        _thread != _st_this_vp.idle_thread &&   \
 
384
        _thread->state != _ST_ST_ZOMBIE) {      \
 
385
      _st_this_vp.switch_out_cb();              \
 
386
    }
 
387
#define ST_SWITCH_IN_CB(_thread)                \
 
388
    if (_st_this_vp.switch_in_cb != NULL &&     \
 
389
        _thread != _st_this_vp.idle_thread &&   \
 
390
        _thread->state != _ST_ST_ZOMBIE) {      \
 
391
      _st_this_vp.switch_in_cb();               \
 
392
    }
 
393
#else
 
394
#define ST_SWITCH_OUT_CB(_thread)
 
395
#define ST_SWITCH_IN_CB(_thread)
 
396
#endif
 
397
 
369
398
/*
370
399
 * Switch away from the current thread context by saving its state and
371
400
 * calling the thread scheduler
372
401
 */
373
402
#define _ST_SWITCH_CONTEXT(_thread)       \
374
403
    ST_BEGIN_MACRO                        \
 
404
    ST_SWITCH_OUT_CB(_thread);            \
375
405
    if (!MD_SETJMP((_thread)->context)) { \
376
406
      _st_vp_schedule();                  \
377
407
    }                                     \
378
408
    ST_DEBUG_ITERATE_THREADS();           \
 
409
    ST_SWITCH_IN_CB(_thread);             \
379
410
    ST_END_MACRO
380
411
 
381
412
/*