Files @ r10525:898f08b99221
Branch filter:

Location: cpp/openttd-patchpack/source/src/fiber.hpp

translators
(svn r14782) -Update: WebTranslator2 update to 2009-01-02 18:38:20
arabic_egypt - 7 fixed by khaloofah (7)
brazilian_portuguese - 14 fixed, 5 changed by tucalipe (19)
catalan - 14 fixed by arnaullv (14)
finnish - 14 fixed by jpx_ (14)
hungarian - 14 fixed by alyr (14)
indonesian - 6 changed by fanioz (6)
korean - 13 fixed by dlunch (13)
malay - 8 fixed by tombakemas (8)
serbian - 29 fixed, 2 changed by nummer (31)
thai - 2 fixed by chat9780 (2)
ukrainian - 13 fixed by mad (1), znikoz (12)
urdu - 20 fixed by yasirniazkhan (20)
/* $Id$ */

/** @file fiber.hpp Base for all fiber related classes. */

#ifndef FIBER_HPP
#define FIBER_HPP

typedef void (CDECL *FiberFunc)(void *);

class Fiber {
public:
	/**
	 * Switch to this fiber.
	 */
	virtual void SwitchToFiber() = 0;

	/**
	 * Exit a fiber.
	 */
	virtual void Exit() = 0;

	/**
	 * Check if a fiber is running.
	 */
	virtual bool IsRunning() = 0;

	/**
	 * Get the 'param' data of the Fiber.
	 */
	virtual void *GetFiberData() = 0;

	/**
	 * Virtual Destructor to mute warnings.
	 */
	virtual ~Fiber() {};

	/**
	 * Create a new fiber, calling proc(param) when running.
	 */
	static Fiber *New(FiberFunc proc, void *param);

	/**
	 * Attach a current thread to a new fiber.
	 */
	static Fiber *AttachCurrent(void *param);

	/**
	 * Get the 'param' data of the current active Fiber.
	 */
	static void *GetCurrentFiberData();
};

#endif /* FIBER_HPP */