Tagged Questions
3
votes
2answers
61 views
Invalid conversion in pthread_create c++ [duplicate]
I have a class named qwerty and a function called compute_ans inside it which takes a void pointer and returns a void pointer. Now when I try to compile, the following statement throws an error
...
1
vote
4answers
45 views
Stuck on a thread issue
So I have this
void* tf(void* p);
which I dont totally understand. What I think it is, is a function pointer with a void pointer for a parameter. I am using it to make a thread like this:
...
0
votes
2answers
153 views
Passing a method as pointer to function [duplicate]
Possible Duplicate:
function pointer for a member function
I have a problem, in a class, I have this method : virtual void start(void *(*ptr)(void*), void *);
In an other one, I want to ...
0
votes
4answers
128 views
How can I pass method pointer as a function parameter in C++ while using pthreads
I have a question related with C++ and threads.
I am more familiar with Java than C++ and this error is confusing me.
Imagine that in x.h file I have a class such as:
class A{
public A();
...
2
votes
2answers
341 views
How to get return value from a function called which executes in another thread?
In the code:
#include <tbb/tbb.h>
int GetSomething()
{
int something;
// do something
return something;
}
// ...
tbb::tbb_thread(GetSomething, ...
0
votes
2answers
42 views
Function call as parameter
I am designing a small threading framework, and i'd like that threading framework to be as transparent as possible to the final code, in such a way that it barely affects the syntax of linear code. ...
0
votes
1answer
613 views
General query about Callback functions and Threads
I have a general question about a threads and callbacks.
Say for example we have a thread running continuously along with a main program.
The main program has registered a callback function with the ...
0
votes
1answer
181 views
C++: OpenMP: Copying function pointers for multithreading
I have a parallelized fitting program (parallelized with OpenMP) that takes the function that it has to fit using function pointers. I've been facing problems, and eventually I found out that I pass ...
0
votes
2answers
77 views
Function Pointer typedef Error
i defined my Function pointer with a typedef like
typedef void (*ThreadFunc)( void *);
my Class member method looks like :
void start( ThreadFunc f, vector<void *> &jobs)
in my main ...
0
votes
3answers
522 views
pthread_create function format and pointers - C Linux POSIX library
The question I have is, what exactly is the format of the pthread_create function and the function it calls, in terms of pointers and such? I can wrap my head around variable pointers, although I ...
3
votes
3answers
612 views
C++ class: pointer to a non-static func
This is my last question. I try to improve my class Thread.
Constructor receives pointer to the function, that must run in a new thread.
class Thread {
public:
Thread(void (*p)()) {
...
2
votes
3answers
2k views
Windows C++ Thread Parameter Passing
In Windows c++, the following creates a thread:
CreateThread(NULL, NULL, function, parameter, NULL, &threadID);
This will run "function" in a new thread and pass it "parameter" as a void* or ...
3
votes
4answers
654 views
Start a thread using a method pointer
I'm trying to develop a thread abstraction (POSIX thread and thread from the Windows API), and I would very much like it to be able to start them with a method pointer, and not a function pointer.
...
0
votes
5answers
342 views
c++ macro wrapped in function pointer to put into vector
I have a macro that might look as follows (from boost log library)
#define L_(lvl) BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), lvl )
Is it possible to wrap this into a boost::function<> ...
2
votes
3answers
476 views
C++ Problem with creating thread using Bind
I have a little problem concerning thread and bind interaction.
It is simple, i have this situation
class myclass {
// ...
// ...
void dosome();
void doanother(myclass2, myclass3*);
...