I also note that a number of the pthread_* calls
have return values that should be checked for: usually
zero for ints is no error, NULL for pointers is error
or no value...  At the least we should be barfing if
something fails rather than silently continuing on.

--Chris

On 8/31/2011 11:03 PM, chm wrote:
On 8/31/2011 8:40 PM, Sisyphus wrote:

----- Original Message ----- From: "Chris Marshall"

Thanks for the confirmation. It means that it should be
possible to get pthreads support in for win32 and cygwin
platforms.

I've hacked Basic/Core/Makefile.PL so that pthread.h and the pthread
library are found on my win32 box.
But the PDL build doesn't get very far.

My pthread.h contains:

#######################
typedef struct {
void * p;
unsigned int x;
} ptw32_handle_t;

typedef ptw32_handle_t pthread_t;
#######################

I believe this is an error in our implementation. According
to discussion at

https://computing.llnl.gov/tutorials/pthreads/#PthreadsAPI

"The concept of opaque objects pervades the design of
the API. The basic calls work to create or modify opaque
objects - the opaque objects can be modified by calls
to attribute functions, which deal with opaque attributes."

Our use of knowledge of the underlying pthread_t type
is the problem. The code needs to be rewritten to be
less specific to a given pthreads implementation.
Not like this would be the first part of PDL with
platform-specific coding... :-)

But line 20 of Basic/Core/pdlmagic.c is:

static pthread_t pdl_main_pthreadID = 0;

I think this should be a pointer to pthread_t
which can be initialized to NULL.

which, of course, generates the error:
pdlmagic.c:20: error: invalid initializer

Also, line 429 of pdlmagic.c contains the expression
"!pdl_main_pthreadID" - which generates the error:

pdlmagic.c:429: error: wrong type argument to unary exclamation mark

I think the pointer would work ok here too but
*pdl_main_pthreadID would need to be used rather
than the pointer itself.

I think this could well turn out to be a not-so-trivial exercise ...

The two fixes so far seem simple. I hope the rest turn out
as clear to sort out. I wouldn't mind having multi-core
acceleration for win32 and cygwin PDL.

--Chris



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to