Deleted Added
sdiff udiff text old ( 12846:f863a61d8b16 ) 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

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

39#undef _XOPEN_SOURCE
40#else
41#include <ucontext.h>
42#endif
43
44#include <cstddef>
45#include <cstdint>
46
47#include "config/have_valgrind.hh"
48
49/**
50 * This class represents a fiber, which is a light weight sort of thread which
51 * is cooperatively scheduled and runs sequentially with other fibers, swapping
52 * in and out of a single actual thread of execution.
53 *
54 * To define your own threads, create a subclass of Fiber and override its
55 * main() function to do what you want your fiber to do. You can start it by
56 * calling its run() method which will stop your execution and start the other

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

103 void start();
104
105 ucontext_t ctx;
106 Fiber *link;
107
108 // The stack for this context, or a nullptr if allocated elsewhere.
109 uint8_t *stack;
110 size_t stackSize;
111#if HAVE_VALGRIND
112 unsigned valgrindStackId;
113#endif
114
115 bool started;
116 bool _finished;
117 void createContext();
118};
119
120#endif // __BASE_FIBER_HH__