B
B
BadCats2019-10-13 15:15:02
Qt
BadCats, 2019-10-13 15:15:02

Relationship between c++ application multithreading and system level multithreading?

The following question arose: in C ++ there are two options for working with multithreading - std::tear and using mutex. But, both of these options, as I understand it, implement multithreading in the application itself - that is, work with a shared object and access to it by several threads. The most banal example:

nt number = 6;

void method1()
{
   mutex.lock();
number *= 5;
number /= 4;
mutex.unlock();
 }

void method2()
{
mutex.lock();
number *= 3;
number /= 2;
     mutex.unlock();
 }

- but, again, it demonstrates multithreading in one day of the broadcast.
The following question arises:
How can I use c++ (Qt in particular) and mutex or WinAPI to organize multithreading in order to block the application thread and prevent the creation (reopening of this application) in a new thread in Windows?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2019-10-13
@BadCats

You have a total mess in your head regarding terms. Understand what is a process and what is a thread, what is the "second way to deal with multithreading using mutexes" and so on. "Multi-threading in one translation unit" is just a masterpiece. How are translation units related to streams?
From your stream of consciousness , I understand that you need QSingleApplication - A thing that prevents the program from running more than once.

B
BadCats, 2019-10-14
@BadCats

https://evileg.com/ru/post/147/
https://www.youtube.com/watch?v=xRp6lZlOFYw
https://habr.com/ru/post/173281/
- option without using QSingleApplication

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question