home *** CD-ROM | disk | FTP | other *** search
- //
- // Stack maintenance
- //
- // Modification History:
- //
- // 05-Dec-89 John Faust
- // Remove all stack free lists. Allocate stacks of fixed size when thread
- // is allocated. Stack remains associated with owning thread. More
- // efficient (removes search of stack freelist for stack of proper size,
- // allocation of stack if one of proper size not found, and eliminates
- // need to balance stack freelists).
- //
- // 16-Nov-1989 John Faust
- // Add support for per-processor stack freelists.
- //
-
- #include "presto.h"
-
- Stack::Stack(int sz)
- {
- register Stack *s = 0;
-
- if (this) {
- error("Can only allocate a stack on the heap");
- }
-
- if (sz) {
- sz = sz &(~0x200); // force page size boundaries
- }
-
- s = (Stack*) new char [sizeof (Stack)];
- this = s;
- //cout << "stack ctor, stack size = " << sz << "\n";
-
- //
- // Init stack.
- //
- // stackcnt++;
- st_base = (int*)new char[sz];
- st_size = sz;
- st_limit = sz;
- }
-
-
- //static shared_t stackcnt = 0;
- int
- Stack::numstacksbuilt()
- {
- // return stackcnt;
- return -1;
- }
-
-
-
-
-
-
-
-