Questions tagged [createthread]

70 questions
1
vote
1 answer

CreateThread() error

#include #include #include #include #include #include void Thread1( LPVOID param) { int a; a = *((int *)param); for (int i= 0; i <10; i++) …
College Kid
  • 11
  • 1
  • 2
1
vote
0 answers

Error when starting thread with CreateThread

I am trying to create a scheduler, and when creating a thread, it gives the following error: argument of type "DWORD (*)(LPVOID lpParameter)" is incompatible with parameter of type "LPTHREAD_START_ROUTINE". I made the thread function static as…
1
vote
2 answers

Using Win32 Event Objects

Noob question: This link shows an example of CreateEvent and CreateThread http://msdn.microsoft.com/en-us/library/ms686915(v=vs.85).aspx My question is if the ThreadProc is truly thread safe? Specifically, the dwWaitResult variable. Since all…
Eric
  • 1,697
  • 5
  • 29
  • 39
1
vote
1 answer

How to check in background whether a minute has passed while execution of the main program in c++?

I have created a program which displays the current time on screen. What I want to do now is to update that time after every minute. dateAndTime now; //created an object of a custom class dateAndTime cout << "\n\t\t\t\t\t\t" << now.hour() << ':' <<…
Maaz Bin Khawar
  • 435
  • 3
  • 13
1
vote
1 answer

error C3867 when calling class function with CreateThread

I try to pass a class function to CreateThread called from main function, I got error : error C3867: 'Display::fill_matrix': function call missing argument list; use '&Display::fill_matrix' to create a pointer to member class Display { public: …
bouqbouq
  • 973
  • 2
  • 14
  • 34
1
vote
0 answers

Does CreateThread provide a memory order guarantee?

While pthread_create provides a memory order guarantee (The Open Group Base Specifications Issue 7: Memory Synchronization), the wording in Synchronization and Multiprocessor Issues: Memory Ordering and the lack of wording in CreateThread function…
Coder
  • 441
  • 2
  • 17
1
vote
0 answers

POSIX threads vs Windows threads

I have some experience with pthreads and am looking into threads in windows. They seem quite similar for the most part I am confused about one thing though. With pthreads the heap of the parent process is shared with the threads meaning that they…
Nickolouse
  • 191
  • 14
1
vote
0 answers

OpenVPN TAP I/O operations blocks forever

Following code hangs forever when GetOverlappedResult gets called, I have not much experience in windows async IO operations, I implemented it as per my understanding. I have used it to access virtual network interface (by openvpn - TAP/TUN…
1
vote
1 answer

SDL_CreateThread invalid conversion

I am trying to make a thread in SDL. I have followed all the directions i can find online, but I i keep getting this error: SDL\sample_profiler.cpp|72|error: invalid conversion from 'int' to 'int ()(void)' [-fpermissive]| The following is my code…
user3618381
1
vote
0 answers

How to end a specific thread which was initialized by _beginthreadex

i want to Close the thread which was initialized by the _beginthreadex. as i am also using Qt for GUI so when i use _endthreadex() then it Closes all threads which are running but i only want to Close or Exit the thread which was began by the…
1
vote
1 answer

Write to file in thread, C++

I wrote a program, which should write "1" in thread for three seconds. But when I try to debug or add controls outputs, I realize that the thread often isn't created (no outputs in the console or achievements of debug point). When I check the return…
user2851729
  • 143
  • 1
  • 7
1
vote
1 answer

recvfrom() returns error 10022 when passing socket handle to thread

I'm working on UDP chat for programming classes. For now, I'm dealing with parallel in/out. So, I'm creating thread to receive messages from server: // in-thread DWORD WINAPI in_thread(void* param) { int n; // variable receivefrom returned …
user3081123
  • 425
  • 6
  • 15
1
vote
2 answers

C++ Exception or passing arguments to thread

I'm trying to pass a structure to my thread using CreateThread() and here is my structure : struct Secure { int UID; LPVOID MainClass; }; And here is the way I call CreateThread() Secure m_Secure =…
Shahriyar
  • 1,483
  • 4
  • 24
  • 37
1
vote
1 answer

TerminateThread() returns error when terminating the thread

I have a ThreadA created using the CreateThread function. Inside ThreadA, another thread, ThreadB is created using the CreateThread function. Now, I want to terminate ThreadB from ThreadA but the TerminateThread function fails. Is it because ThreadA…
Ayse
  • 2,676
  • 10
  • 36
  • 61
1
vote
1 answer

Threading in C with CreateThread()

I am very much a novice to C, and I am trying to make a program to run MIDI sequences, and basically, I have two functions, both running a different MIDI pattern, and I need them to run in parallel. Due to the nature of the functions (one running a…
user2366293
  • 11
  • 1
  • 1
  • 2