/usr/include/wvstreams/wvwin32task.h is in libwvstreams-dev 4.6.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /* -*- Mode: C++ -*- */
#ifndef __WVWIN32TASK_H
#define __WVWIN32TASK_H
#include "wvstring.h"
#include "wvlinklist.h"
#include <windows.h>
#define WVTASK_MAGIC 0x123678
class WvTaskMan;
class WvTask
{
friend class WvTaskMan;
typedef void TaskFunc(void *userdata);
static int taskcount, numtasks, numrunning;
int magic_number, *stack_magic;
WvString name;
int tid;
size_t stacksize;
bool running, recycled;
WvTaskMan &man;
LPVOID mystate; // used for resuming the task
TaskFunc *func;
void *userdata;
static VOID CALLBACK MyFiberProc(PVOID lpParameter);
WvTask(WvTaskMan &_man, size_t _stacksize = 64*1024);
public:
virtual ~WvTask();
void start(WvStringParm _name, TaskFunc *_func, void *_userdata);
bool isrunning() const
{ return running; }
void recycle();
int get_tid() const { return tid; }
WvString get_name() const { return name; }
};
DeclareWvList(WvTask);
/** Provides co-operative multitasking support among WvTask instances. */
class WvTaskMan
{
friend class WvTask;
static WvTaskMan *singleton;
static int links;
static int magic_number;
static WvTaskList free_tasks;
static void get_stack(WvTask &task, size_t size);
static void stackmaster();
static void _stackmaster();
static void do_task();
static WvTask *stack_target;
static WvTask *current_task;
static LPVOID toplevel;
WvTaskMan();
virtual ~WvTaskMan();
public:
/// get/dereference the singleton global WvTaskMan
static WvTaskMan *get();
static void unlink();
WvTask *start(WvStringParm name,
WvTask::TaskFunc *func, void *userdata,
size_t stacksize = 256*1024);
// run() and yield() return the 'val' passed to run() when this task
// was started.
static int run(WvTask &task, int val = 1);
static int yield(int val = 1);
static WvTask *whoami()
{ return current_task; }
};
#endif // __WVWIN32TASK_H
|