Click here to Skip to main content
14,362,031 members

C / C++ / MFC

 
AnswerRe: How to make a c++ executable Pin
CPallini30-Sep-18 22:48
mveCPallini30-Sep-18 22:48 
GeneralRe: How to make a c++ executable Pin
Member 139824711-Oct-18 7:37
memberMember 139824711-Oct-18 7:37 
GeneralRe: How to make a c++ executable Pin
Maximilien1-Oct-18 7:58
memberMaximilien1-Oct-18 7:58 
GeneralRe: How to make a c++ executable Pin
Member 139824711-Oct-18 9:54
memberMember 139824711-Oct-18 9:54 
AnswerRe: How to make a c++ executable Pin
Member 140094495-Oct-18 16:30
memberMember 140094495-Oct-18 16:30 
QuestionAccess a class instance based on its ID Pin
meerokh29-Sep-18 7:50
membermeerokh29-Sep-18 7:50 
AnswerRe: Access a class instance based on its ID Pin
Richard MacCutchan30-Sep-18 2:55
protectorRichard MacCutchan30-Sep-18 2:55 
GeneralRe: Access a class instance based on its ID Pin
meerokh30-Sep-18 4:52
membermeerokh30-Sep-18 4:52 
It got stored in an instance of class WorkPackage which in turn is added to packagequeue

WorkPackage.h
class WorkPackage {
private:
	WorkPackageState wp_state;
	void (*m_action)(void*);
	void* m_arguments = nullptr;
protected:
	static int id;

public:
	WorkPackage(){};
	WorkPackage(void (*action)(void*), void* arguments);
	void destroystack();
	void execute();
	static void setState(WorkPackageState wp_state);
	WorkPackageState getState();
	Stack Wp_localstack;
	fcontext_t m_context;
	int packageId;
};


Workpackage.cpp
WorkPackage::WorkPackage(void (*action)(void*), void* arguments) {
		Wp_localstack.local_stack= Stack::make_stack();
		m_action = action;
		m_arguments = arguments;
		Wp_localstack.local_stack = static_cast <char *>(Wp_localstack.local_stack) + 1000;
		m_context = make_fcontext(Wp_localstack.local_stack, 1000, m_action);
		wp_state = running;
		packageId=++id;
}

WorkPackageState WorkPackage::getState() {
	return state;
}

void WorkPackage::execute(int thread_id) {
	m_action(m_arguments);
	destroystack();
}

void WorkPackage::setState(WorkPackageState state) {
	WorkPackageState new_state = state;
}

GeneralRe: Access a class instance based on its ID Pin
Richard MacCutchan30-Sep-18 5:45
protectorRichard MacCutchan30-Sep-18 5:45 
QuestionCan anyone tell me if c++ is worth learning? Pin
Member 1398247125-Sep-18 5:11
memberMember 1398247125-Sep-18 5:11 
AnswerRe: Can anyone tell me if c++ is worth learning? Pin
Dar Brett25-Sep-18 5:49
memberDar Brett25-Sep-18 5:49 
GeneralRe: Can anyone tell me if c++ is worth learning? Pin
Member 1398247125-Sep-18 6:00
memberMember 1398247125-Sep-18 6:00 
GeneralRe: Can anyone tell me if c++ is worth learning? Pin
Dar Brett25-Sep-18 6:02
memberDar Brett25-Sep-18 6:02 
GeneralRe: Can anyone tell me if c++ is worth learning? Pin
Member 1398247125-Sep-18 6:06
memberMember 1398247125-Sep-18 6:06 
GeneralRe: Can anyone tell me if c++ is worth learning? Pin
Dar Brett25-Sep-18 6:19
memberDar Brett25-Sep-18 6:19 
GeneralRe: Can anyone tell me if c++ is worth learning? Pin
Member 1398247125-Sep-18 6:21
memberMember 1398247125-Sep-18 6:21 
AnswerRe: Can anyone tell me if c++ is worth learning? Pin
Joe Woodbury25-Sep-18 6:51
professionalJoe Woodbury25-Sep-18 6:51 
AnswerRe: Can anyone tell me if c++ is worth learning? Pin
CPallini25-Sep-18 22:18
mveCPallini25-Sep-18 22:18 
QuestionCAsynSocket Client Question Pin
ForNow23-Sep-18 5:10
memberForNow23-Sep-18 5:10 
AnswerRe: CAsynSocket Client Question Pin
Richard Andrew x6423-Sep-18 6:37
professionalRichard Andrew x6423-Sep-18 6:37 
GeneralRe: CAsynSocket Client Question Pin
ForNow23-Sep-18 6:43
memberForNow23-Sep-18 6:43 
AnswerRe: CAsynSocket Client Question Pin
Victor Nijegorodov23-Sep-18 9:23
memberVictor Nijegorodov23-Sep-18 9:23 
QuestionC Programming Pin
Member 1399372921-Sep-18 23:29
memberMember 1399372921-Sep-18 23:29 
AnswerRe: C Programming Pin
Victor Nijegorodov22-Sep-18 0:35
memberVictor Nijegorodov22-Sep-18 0:35 
AnswerRe: C Programming Pin
CPallini23-Sep-18 22:44
mveCPallini23-Sep-18 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.