-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSHM_thread.cpp
More file actions
69 lines (50 loc) · 1.44 KB
/
SHM_thread.cpp
File metadata and controls
69 lines (50 loc) · 1.44 KB
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
#include "stdafx.h"
#include "tools++.h"
#include "http_tool.h"
#include "SHM_thread.h"
#include "SharedMemWin.h"
using namespace jbxl;
//using namespace jbxwl;
UINT shm_reader(LPVOID pntprm)
{
ShmParam* p_shmparam = (ShmParam*)pntprm;
while (*(p_shmparam->p_state)==SHM_EXEC) {
int cc = p_shmparam->pShm->get();
shm_saveBuffer(p_shmparam->pShm->buf, p_shmparam, INFO_DATA);
}
shm_thread_stop(p_shmparam);
return 0;
}
///////////////////////////////////////
void shm_saveBuffer(Buffer* buf, ShmParam* p_shmparam, int input)
{
CBufferRing* pBR =p_shmparam->pDoc->bufferRing;
CSingleLock lock(&(p_shmparam->pDoc->criticalKey));
lock.Lock();
while (!lock.IsLocked()) {
Sleep(100);
lock.Lock();
}
pBR->putBufferRing(buf, input, BINHEX_DATA);
int lastPos = pBR->getLastPosition();
if (p_shmparam->binhexmode) {
pBR->rewriteBinHexBufferRing(lastPos-1, input);
}
lock.Unlock();
InvalidateRect(p_shmparam->hwnd, NULL, FALSE);
return;
}
void shm_thread_stop(ShmParam* p_shmparam)
{
*(p_shmparam->p_state) = SHM_STOP;
/*
tList* lp = Thread_List->next;
while (lp!=NULL) {
CWinThread* thr = (CWinThread*)(lp->ldat.ptr);
if (thr!=NULL) thr->PostThreadMessageA(WM_QUIT, 0, 0);
lp = lp->next;
}
del_tList(&(Thread_List->next));
*/
}