?? rwerdlg.h
字號:
// RWerDlg.h : header file
//
#if !defined(AFX_RWERDLG_H__4CDBF419_54FA_4CFC_9FA3_3D999A1200AA__INCLUDED_)
#define AFX_RWERDLG_H__4CDBF419_54FA_4CFC_9FA3_3D999A1200AA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WM_READ_START (WM_USER + 1)//開始讀
#define WM_R_WAIT (WM_USER+5)//發送等待者數
#define WM_READ_END (WM_USER + 2)//讀完了
#define WM_WRITE_START (WM_USER + 3)//開始寫
#define WM_W_WAIT (WM_USER+6)//發送等待者數
#define WM_WRITE_END (WM_USER + 4)//寫完了
/////////////////////////////////////////////////////////////////////////////
// CRWerDlg dialog
//struct TEST;
class CRWerDlg;
#define MAX_SIZE 11
struct TEST
{
int index;//線程號
int type;//類型 0為讀 1為寫
int TStart,TContinu;//開始時間與持續時間
};
struct PARAM//用于傳參
{
CRWerDlg* hwnd;
TEST *infor;
};
class CRWerDlg : public CDialog
{
// Construction
public:
LONG ST;//CHU存放時間的秒數
int finish;
void setInit();
int totalThread;//總線程數
int s;//bao保存進入線程的寫者數
CMutex listMutex,RcountMutex,writeMutex,S,
WcountMutex;//用于保護s
int Rcount,Rtemp,readTotal,Rwait,Wcount,Wtemp,Wwait,writeTotal;
void addListBox(int type ,int id);
/*listMutex,//控制對列表框的互斥訪問
RcountMutex,// 控制對正在工作的讀者數的互斥訪問
WcountMutex // 控制對等待或已進入線程的寫者數的互斥訪問
writeMutex,// 控制對讀寫資源的的互斥訪問
S//用于實現寫者優先,使得當至少一個寫者準備訪問共享對象時,他之后的讀者線程等待寫完成;
*//*CSemaphore * m_pMaxNumSemaphore// 指向新定義的信號量,允許m_Rmax個讀者同時訪問共享對象m_Rmax的值可指定;
Rcount,// 正在工作的讀者數
Rtemp//完成工作任務的讀者數,
readTotal,//總讀者數
Rwait,//等待的讀者數
Wcount,// 正在工作的
Wtemp, //完成工作任務的寫者數
Wwait,// 等待的寫者數
writeTotal;//總寫者數
*/
CWinThread * m_pThread[MAX_SIZE];
CSemaphore * m_pMaxNumSemaphore;
void filetobuffer(CString pathname,TEST buffer[]);
void buffertofile(const TEST buffer[],CString pathname);
CRWerDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CRWerDlg)
enum { IDD = IDD_RWER_DIALOG };
CListBox m_listBox;
CString m_pathName;
int m_write_priority;
int m_Rmax;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRWerDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
void data2text(CString name);
// Generated message map functions
afx_msg LONG ReadStart(UINT wParam,LONG lParam);
afx_msg LONG RWait(UINT wParam,LONG lParam);
afx_msg LONG ReadEnd(UINT wParam,LONG lParam);
afx_msg LONG WriteStart(UINT wParam,LONG lParam);
afx_msg LONG WWait(UINT wParam,LONG lParam);
afx_msg LONG WriteEnd(UINT wParam,LONG lParam);
//{{AFX_MSG(CRWerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBrowse();
afx_msg void OnCustomize();
afx_msg void OnLoad();
afx_msg void OnStart();
virtual void OnOK();
//afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnClear();
afx_msg void OnSave();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void getRWtotal(int & r,int & w);
};
class CCustomizeDialog : public CDialog
{
// Construction
public:
void viewtobuffer(TEST *buffer,int m_threadCount);
CCustomizeDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CCustomizeDialog)
enum { IDD = IDD_DIALOG1 };
CComboBox m_type9;
CComboBox m_type8;
CComboBox m_type7;
CComboBox m_type6;
CComboBox m_type5;
CComboBox m_type4;
CComboBox m_type3;
CComboBox m_type2;
CComboBox m_type10;
CComboBox m_tpye1;
int m_threadCount;
UINT m_start1;
UINT m_start2;
UINT m_start3;
UINT m_start4;
UINT m_start5;
UINT m_start6;
UINT m_start7;
UINT m_start8;
UINT m_start9;
UINT m_start10;
UINT m_continu1;
UINT m_continu2;
UINT m_continu3;
UINT m_continu4;
UINT m_continu5;
UINT m_continu6;
UINT m_continu7;
UINT m_continu8;
UINT m_continu9;
UINT m_continu10;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCustomizeDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CCustomizeDialog)
virtual BOOL OnInitDialog();
afx_msg void OnChangeThreadCount();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnSelchangeCombo1();
virtual void OnOK();
afx_msg void OnKillfocusThreadCount();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void enableCtrl(int nCount);
void disableCtrl(int nCount);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RWERDLG_H__4CDBF419_54FA_4CFC_9FA3_3D999A1200AA__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -