Deleted Added
sdiff udiff text old ( 12787:1f6e23cddf71 ) new ( 12920:76a7817ebea3 )
full compact
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include "base/fiber.hh"
31
32#include <cerrno>
33#include <cstring>
34
35#include "base/logging.hh"
36
37using namespace std;
38
39namespace

--- 26 unchanged lines hidden (view full) ---

66{
67 startingFiber->start();
68}
69
70Fiber::Fiber(size_t stack_size) :
71 link(primaryFiber()),
72 stack(stack_size ? new uint8_t[stack_size] : nullptr),
73 stackSize(stack_size), started(false), _finished(false)
74{}
75
76Fiber::Fiber(Fiber *link, size_t stack_size) :
77 link(link), stack(stack_size ? new uint8_t[stack_size] : nullptr),
78 stackSize(stack_size), started(false), _finished(false)
79{}
80
81Fiber::~Fiber()
82{
83 panic_if(stack && _currentFiber == this, "Fiber stack is in use.");
84 delete [] stack;
85}
86
87void
88Fiber::createContext()
89{
90 // Set up a context for the new fiber, starting it in the trampoline.
91 getcontext(&ctx);

--- 57 unchanged lines hidden ---