View Single Post
  #7 (permalink)  
Old 05-05-2011, 02:11 PM
AmeiseMike's Avatar
AmeiseMike
Lurker
Offline
Threadstarter
 
Join Date: May 2009
Posts: 22
Reputation: 5
AmeiseMike is a n00b
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: Alternatives to current development

Quote:
Originally Posted by vinceweis View Post
When you have a version that loads on my Tilt2, I will give it a try. In the mean time, asking others to execute your ideas won't make it happen. Give us a plausable example.
Well, something I just wrote up. Doesn't handle attributes, but this is something such as pthread_create (don't mind syntax errors, I didn't try to compile it or check it, just wrote it quickly):

Code:
typedef struct pthread
{
	HANDLE mThreadHandle;
} pthread_t;

int pthread_create(
	pthread_t * restrict thread,
	const pthread_attr_t * restrict attr,
	void * (*start_routine)(void *),
	void * restrict arg
)
{
	//ignore attr for now
	thread = malloc(sizeof(pthread_t));
	thread->mThreadHandle = CreateThread(
		NULL,	//security descriptor LPSECURITY_ATTRIBUTES
		0,	//stack size. 0 is default
		/*
		** the below is kinda wonky, and won't work on x64 systems.
		** All current ARM processors are 32-bit.
		** The size of a DWORD (as Win32/64 defines as the return type)
		** is the same as the size of a pointer (as POSIX
		** has as the return type) on 32-bit architectures.
		*/
		(LPTHREAD_START_ROUTINE)start_routine,
		arg,
		0,	//start immediately
		NULL	//ptr to thread ID
	);

	if (thread->mThreadHandle == NULL)
	{
		//process from GetLastError. Don't feel like doing right now.
		return EINVAL;
	}
	return 0;
}
Reply With Quote