C11 introduces native threading.
Questions tagged [cthreads]
5 questions
3
votes
1 answer
Cpp threads is not working as expected when loops are involved
C++ sleep_for method is not working as expected. I'm trying to write a program that prints from 1 to 10 but with some time gap between each print.
1
(after 1 sec)
2
(after 1 sec)
3
.
.
.
and so on.
the code is:
#include
#include…

Ashwin Prasad
- 108
- 1
- 6
1
vote
2 answers
Meaning of pthread_create function and its parameters
I don't understand deeply the
pthread_create function and its parameters in c language.
int pthread_create(
pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine)(void*),
void *arg);
Why is the first parameter and the…

GDD
- 11
- 1
0
votes
1 answer
Why is the cond variable not atomicaly releasing?
The following code can be found in the book "Pthreads programming" (O'Reilly media):
#include
#include
#include
#include
#define TCOUNT 10
#define WATCH_COUNT 12
int count = 0;
pthread_mutex_t…
0
votes
1 answer
Create a .NET Threading.Timer with a period Timeout.Infinite
What I want, a windows service that performs a function with a interval, without opening multiple threads.
What I did, using a Threading.Timer I created the following code:
protected override void OnStart(string[] args) {
System.Threading.Timer…

Raul Pires
- 9
- 3
-1
votes
2 answers
Does C provide an API to programatically get the maximum possible number of concurrent threads on a system?
In C++, the standard library provides the unsigned int std::thread::hardware_concurrency(); function as a platform-independent way to get the number of available concurrent threads at runtime.
In Golang, the same information is provided by the…

Jules
- 14,200
- 13
- 56
- 101