Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: Make screen bigger Pin
Richard Deeming3-Oct-18 10:10
mveRichard Deeming3-Oct-18 10:10 
GeneralRe: Make screen bigger Pin
David Crow1-Oct-18 9:12
David Crow1-Oct-18 9:12 
AnswerRe: Make screen bigger Pin
Victor Nijegorodov1-Oct-18 9:20
Victor Nijegorodov1-Oct-18 9:20 
GeneralRe: Make screen bigger Pin
Member 139824711-Oct-18 9:28
Member 139824711-Oct-18 9:28 
GeneralRe: Make screen bigger Pin
Victor Nijegorodov1-Oct-18 9:47
Victor Nijegorodov1-Oct-18 9:47 
GeneralRe: Make screen bigger Pin
Member 139824711-Oct-18 10:19
Member 139824711-Oct-18 10:19 
GeneralRe: Make screen bigger Pin
Victor Nijegorodov1-Oct-18 10:58
Victor Nijegorodov1-Oct-18 10:58 
GeneralRe: Make screen bigger Pin
Member 139824711-Oct-18 13:29
Member 139824711-Oct-18 13:29 
GeneralRe: Make screen bigger Pin
Richard MacCutchan1-Oct-18 22:50
mveRichard MacCutchan1-Oct-18 22:50 
QuestionHow to make a c++ executable Pin
Member 1398247130-Sep-18 8:39
Member 1398247130-Sep-18 8:39 
AnswerRe: How to make a c++ executable Pin
Richard Andrew x6430-Sep-18 9:42
professionalRichard Andrew x6430-Sep-18 9:42 
GeneralRe: How to make a c++ executable Pin
Member 1398247130-Sep-18 13:24
Member 1398247130-Sep-18 13:24 
AnswerRe: How to make a c++ executable Pin
Richard Andrew x6430-Sep-18 14:02
professionalRichard Andrew x6430-Sep-18 14:02 
GeneralRe: How to make a c++ executable Pin
Member 1398247130-Sep-18 14:29
Member 1398247130-Sep-18 14:29 
GeneralRe: How to make a c++ executable Pin
Richard MacCutchan30-Sep-18 21:06
mveRichard MacCutchan30-Sep-18 21:06 
AnswerRe: How to make a c++ executable Pin
CPallini30-Sep-18 21:48
mveCPallini30-Sep-18 21:48 
GeneralRe: How to make a c++ executable Pin
Member 139824711-Oct-18 6:37
Member 139824711-Oct-18 6:37 
GeneralRe: How to make a c++ executable Pin
Maximilien1-Oct-18 6:58
Maximilien1-Oct-18 6:58 
GeneralRe: How to make a c++ executable Pin
Member 139824711-Oct-18 8:54
Member 139824711-Oct-18 8:54 
AnswerRe: How to make a c++ executable Pin
Member 140094495-Oct-18 15:30
Member 140094495-Oct-18 15:30 
QuestionAccess a class instance based on its ID Pin
meerokh29-Sep-18 6:50
meerokh29-Sep-18 6:50 
AnswerRe: Access a class instance based on its ID Pin
Richard MacCutchan30-Sep-18 1:55
mveRichard MacCutchan30-Sep-18 1:55 
GeneralRe: Access a class instance based on its ID Pin
meerokh30-Sep-18 3:52
meerokh30-Sep-18 3: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 4:45
mveRichard MacCutchan30-Sep-18 4:45 
QuestionCan anyone tell me if c++ is worth learning? Pin
Member 1398247125-Sep-18 4:11
Member 1398247125-Sep-18 4:11 

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.