The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Multithreading in originc
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

isteiner

Germany
3 Posts

Posted - 10/26/2012 :  05:49:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.: 8.6 Pro SR3
Operating System: WinXp

I'm doing a lot of data fitting, so I'd like to speed up things by spreading the work to all of my four processor cores.

OriginC documents the createthread() function, but doesn't give any example. I've been trying with the code below. But so far I'm only getting two segmentation faults when calling start().

Has anybody succeeded in starting multiple threads?


#include <Origin.h>
#include <mswin.h>

DWORD WINAPI funcw(LPVOID lpParam)
{
	for (int j=0;j<1000000;j++) {
		// Wasting some time...
	}
	return 0;
}
void start() {
	HANDLE h[2]; 
	DWORD  id[2];

	for (int i=0;i<2;i++) {
		CreateThread(NULL,0,funcw,NULL,0,&id[i]);
	}
}

JessieWoo

China
46 Posts

Posted - 10/30/2012 :  04:14:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

OriginC: createthread() function is a windows API. You can refer to the example below provided by Microsoft.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682516(v=vs.85).aspx

Best Regard,
Jessie
Originlab Corp.

Edited by - JessieWoo on 10/30/2012 04:30:14 AM
Go to Top of Page

isteiner

Germany
3 Posts

Posted - 10/30/2012 :  04:20:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your reply, Yessie.

But link to the example goes nowhere!
Could you please check the microsoft website.

Regards,
Ingo

Edited by - isteiner on 10/30/2012 06:34:37 AM
Go to Top of Page

isteiner

Germany
3 Posts

Posted - 10/30/2012 :  06:35:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To give it another try, I copied the code to Visual Studio.
There I can start several threads without any problem.

When I step through the code in the Origin debugger so slowly, that the first thread exits before the second one starts, I don't get any error.

I suppose there must be some bug in Origin, that causes the crash, when several threads are executing in parallel, even if they don't access any shared data.

Regards,
Ingo
Go to Top of Page

JessieWoo

China
46 Posts

Posted - 11/02/2012 :  03:40:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Sorry that I have just double checked with our developer, Origin does not support multi-thread yet. This function does not work well with Origin.

Best Regard,
Jessie
Originlab Corp.
Go to Top of Page

MultiThread

1 Posts

Posted - 03/23/2015 :  09:56:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Are there any news about multiple threads?
Any chance to do it?
Go to Top of Page

yuki_wu

896 Posts

Posted - 09/27/2018 :  01:38:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I am sorry that the current version of Origin still doesn’t support multi-thread.

Origin provides embedded Python support now. You may try to use the feature of multi-thread that Python supports in Origin if you are interested in this topic.

Regards,
Yuki

OriginLab

Edited by - yuki_wu on 09/27/2018 01:38:45 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000