T
Thomas Barth
Hi,
I dont understand the third argument of this function. This function
expect the address of a function, but what does "void *(*funktion)(void
*)," mean? I am confused by so many "wildcards"
int pthread_create( pthread_t *thread,
const pthread_attr_t *attribute,
void *(*funktion)(void *),
void *argumente );
When invoking the pthread_create function I get an error at compile time.
[...]
void BlockOp::start() {
if(pthread_create(&pth, NULL, &BlockOp:rocess, cBuffer) != 0) {
...
}
}
void BlockOp:rocess() {
int i;
for (i = 0; i < iLimit; ++i) {
...
}
pthread_exit((void *) val++);
}
[...]
error: cannot convert `void (BlockOp::*)()' to `void*(*)(void*)' for
argument `3' to `int pthread_create(pthread_t*, const pthread_attr_t*,
void*(*)(void*), void*)' BlockOp.cpp blockop line 17
Any idea how to clear it up?
Regards,
T h o m a s B
I dont understand the third argument of this function. This function
expect the address of a function, but what does "void *(*funktion)(void
*)," mean? I am confused by so many "wildcards"
int pthread_create( pthread_t *thread,
const pthread_attr_t *attribute,
void *(*funktion)(void *),
void *argumente );
When invoking the pthread_create function I get an error at compile time.
[...]
void BlockOp::start() {
if(pthread_create(&pth, NULL, &BlockOp:rocess, cBuffer) != 0) {
...
}
}
void BlockOp:rocess() {
int i;
for (i = 0; i < iLimit; ++i) {
...
}
pthread_exit((void *) val++);
}
[...]
error: cannot convert `void (BlockOp::*)()' to `void*(*)(void*)' for
argument `3' to `int pthread_create(pthread_t*, const pthread_attr_t*,
void*(*)(void*), void*)' BlockOp.cpp blockop line 17
Any idea how to clear it up?
Regards,
T h o m a s B