This is a little embarassing asking this because I used to know this. How do you create a seperate thread in C++ and have mutexes, semiphores and all that. I have forgotten and I wonder if anyone knows a good example.

Recommended Answers

All 4 Replies

depends on the operating system. For ms-windows, I use CreateThread() and CreateMutex(). see MSDN for details.

depends on the operating system. For ms-windows, I use CreateThread() and CreateMutex(). see MSDN for details.

Ok.

Are these things that require MFC? The information I got from Microsoft was __declspc(thread), _beginthread() and _endthread()

none of those functions require MFC. _beginthread() can also be used, but I find it more convenient to use CreateThread(). Here is an example.

Lots of good help.

I will add to your rep.

Now I want to know is this.

How do I open a window in a seperately called thread of execution?

I cannot do it in MFC because MFC requires its own thread of execution.

But even when I create a windows app without MFC, it seems entry point. _t winMain is called by an main thread of execution nested in a microsoft routine. I want my own thread to call my own winmain. How do I do this?

(Maybe I need to look at the mozilla open source to see)

Be a part of the DaniWeb community

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