Hi,
i am new to pthread area.

i like to pass the dynamic argument into the thread function.

example

function(void *value)
{
    printf("%s",(char *)value);
}

here i like to pass dynamic argument when thread is running. so is it possible in pthread?
please share your ideas...

Recommended Answers

Yes its possible, that's why it has the void* args parameter.

Jump to Post

All 3 Replies

Yes its possible, that's why it has the void* args parameter.

hi,
Is it possible pass the value without using pthread_create() function?...
ie , directly pass the value to that thread function...

hi,
Is it possible pass the value without using pthread_create() function?...
ie , directly pass the value to that thread function...

You must understand that a pthread shares the address space with the main executable so it literally has access to anything that the main executable has access to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.