fiber.hh (12846:f863a61d8b16) | fiber.hh (12920:76a7817ebea3) |
---|---|
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 | 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 |
|
47/** 48 * This class represents a fiber, which is a light weight sort of thread which 49 * is cooperatively scheduled and runs sequentially with other fibers, swapping 50 * in and out of a single actual thread of execution. 51 * 52 * To define your own threads, create a subclass of Fiber and override its 53 * main() function to do what you want your fiber to do. You can start it by 54 * calling its run() method which will stop your execution and start the other --- 46 unchanged lines hidden (view full) --- 101 void start(); 102 103 ucontext_t ctx; 104 Fiber *link; 105 106 // The stack for this context, or a nullptr if allocated elsewhere. 107 uint8_t *stack; 108 size_t stackSize; | 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 |
|
109 110 bool started; 111 bool _finished; 112 void createContext(); 113}; 114 115#endif // __BASE_FIBER_HH__ | 114 115 bool started; 116 bool _finished; 117 void createContext(); 118}; 119 120#endif // __BASE_FIBER_HH__ |