ProcControl and Stackwalker windows stubs; initial implementation of some dthread...
[dyninst.git] / common / dthread-win.C
1 #include "common/h/dthread.h"
2 #include <assert.h>
3
4 DThread::DThread()
5 {
6 }
7
8 DThread::~DThread()
9 {
10 }
11
12 long DThread::self()
13 {
14         return (long)::GetCurrentThread();
15 }
16 bool DThread::spawn(DThread::initial_func_t func, void *param)
17 {
18         thrd = ::CreateThread(NULL, 0, func, param, 0, NULL);
19         live = (thrd != INVALID_HANDLE_VALUE);
20         return live;
21 }
22 bool DThread::join()
23 {
24         assert(live && self() != id());
25         ::WaitForSingleObject(thrd, INFINITE);
26         return true;
27 }
28
29 long DThread::id()
30 {
31         return (long)thrd;
32 }
33
34
35 Mutex::Mutex(bool recursive)
36 {
37         mutex = ::CreateMutex(NULL, false, NULL);
38 }
39
40 Mutex::~Mutex()
41 {
42         ::CloseHandle(mutex);
43 }
44
45 bool Mutex::lock()
46 {
47         return (::WaitForSingleObject(mutex, INFINITE) == WAIT_OBJECT_0);
48 }
49
50 bool Mutex::unlock()
51 {
52         return ::ReleaseMutex(mutex);
53 }
54
55 CondVar::CondVar(Mutex *m)
56 {
57 }
58 CondVar::~CondVar()
59 {
60 }
61
62 bool CondVar::unlock()
63 {
64         assert(!"Not implemented");
65         return false;
66 }
67 bool CondVar::lock()
68 {
69         assert(!"Not implemented");
70         return false;
71 }
72 bool CondVar::signal()
73 {
74         assert(!"Not implemented");
75         return false;
76 }
77 bool CondVar::broadcast()
78 {
79         assert(!"Not implemented");
80         return false;
81 }
82 bool CondVar::wait()
83 {
84         assert(!"Not implemented");
85         return false;
86 }