keep a thread alive in a dll?

1320 byte By djodra at 2007-12-5 22:13:59
Hi,I am developing a dll in C and I have one problem that I don't know how to solve... An external application invokes my dll by calling the function:int calculateParameters(int, int)I need to return to the application the value "OK" indicating that the passed parameters are correct as soon as...

Windows HyperThreading Question

725 byte By shahin at 2007-12-4 23:57:12
Hello AllI have a quite general question about Hyper threading in windows and how it effects the speed of a program and ....My limited understanding is that Hyper threading is a way of simulating a "Dual processor" . It is also for some operations to be performed at the same time ( am I right).I hav...

New question on PostThreadMessage & shared memory

348 byte By cyberninja at 2007-12-4 10:39:30
New question on PostThreadMessage & shared memory I tried the functionality of PostThreadMessage and mapping file (shared memory)on a console test harness and they work fine.However, when I copy my testing code to an NT service, both of them seem no longer work. Should PostThreadMessage work with an...

FIFO thread synchronizing

690 byte By menny_ed at 2007-12-3 19:26:00
Hello,i'm programming a multithreaded communication application. Some of the communication operations are being hold in a a shared (for all threads) synchronized queue. the synchronized queue is using c++ 'CRITICAL_SECTION' handle (using the 'EnterCriticalSection' and '...

Creating Windows in threads

971 byte By Gyannea at 2007-12-1 0:35:05
I seemed to have found out the hard way that I have to have a separate message loop to create a window in a thread. This is a terrible discovery since its the last thing I want to do is to burden this critical thread with a message loop...I want to keep it exclusively for handling sound data and DS...

need help ?

226 byte By Nostradamus at 2007-11-29 14:56:36
i write a server/client program (chat)<br/> From now. I don't know how to handle Multi client. Multithreading must be exactly what i need.<br/> But how. any useful metarial for me u guy ? (about socket and multithreading)

[RESOLVED] Critical Section

109 byte By verifier at 2007-11-27 0:19:32
Can a critical section be locked multiple times by the same thread? (As long as it is unlocked as many times)

Suggestions on how to implement this?

1619 byte By ShaChris23 at 2007-11-25 11:47:40
I'm writing code in C++, and I have 3 classes. 1) Memory 2) Producer 3) Consumer.The Memory class has N blocks of memory; it provides a public interface for Read() and Write() blocks of data. It's thread-safe because of mutex.The Producer class is a thread, will keep Write() data to differ...

thread is runing in background?!

577 byte By Abalfazl at 2007-11-25 11:39:22
Hello frineds!it is said:Foreground and Background ThreadsBy default, threads are foreground threads, meaning they keep the application alive for as long as any one of them is running. C# also supports background threads, which dont keep the application alive on their own terminating immediately on...

Mutithreading

107 byte By SwagatikaSahoo at 2007-11-25 11:36:19
Please help me a simple example of Mutithreading.<br/>I donot know how use the mutithreading in MFC or VC++

Mutithreading

107 byte By SwagatikaSahoo at 2007-11-25 11:36:17
Please help me a simple example of Mutithreading.<br/>I donot know how use the mutithreading in MFC or VC++

Binary semaphores

470 byte By ironroot at 2007-11-25 11:33:32
Hi all;I need to figure out how to creat some binary semaphores to control two types of threads. Thread type one add a value to a buffer and thread type two wants to remove a value from the buffer. I want to prevent type one from adding a value to the buffer when the second type is removing a value...

Multithreaded Article Announcement

95 byte By Arjay at 2007-11-25 11:30:45
I just wrote another article on multithreading. Is it appropriate to announce it in this forum?

Is it possible to ensure a piece of code executed without context switch?

206 byte By tangjun at 2007-11-25 11:27:51
I need to send 256 bytes over serial port without any interrupt, it will take less than 500 ms, but any context switch will fail the task. Is it possible to make this short period of time no context switch?

TerminateThread

134 byte By dellthinker at 2007-11-25 11:22:19
Hi all. Does TerminateThread have to be inside the same funtion as CreateThread does in order to terminate properly? Thanx in advance!

[RESOLVED] Use of Web Services

1200 byte By mnopups at 2007-11-25 11:21:47
Hi,I have a VB form with a RichTextBox defined on it. My program needs to import a data file and based on that data file, it will make various web service calls. At the completion of each web service call, an additional text string is appended to the RichTextBox control. I am calling me.refresh foll...

Invalid thread handle

820 byte By HTS at 2007-11-25 11:20:53
Hello, I am creating a thread (let's call it thread B) from within another thread (thread A) , and saving the thread handle returned by AfxBeginThread. Before returning from thread A, I wait for thread B to terminate, using WaitForSingleObject with the thread handle. Problem is: if thread B...

Thread in c++

196 byte By MFCQuery at 2007-11-25 11:20:32
Hi,<br/>Please give a sample to use thread in c++. Without thread main application dont response to user. It looks like program is hang. If i use a thread then main application will responce.

Terminating Worker Thread from my UI thread causing problem?

1843 byte By dp_76 at 2007-11-25 11:13:39
HiFrom the main thread of my NFC based SDi application, i am creating a UI thread. Now from within the UI thread, i am creating a worker thread that does a very crucial job.This worker thread has the tendancy to hang in certain situations.To handle this hang sitaution, i wait on this worker thread f...

diferences in multithreading between wXP & 2000

848 byte By rgalopo at 2007-11-25 11:12:47
Hi all !Im developing a multithreading C# application in which one I invoke several web service methods in the same machine. Those web services have been developed with java / Apache web server, and I cant change them.The multithreaded application has a heavy CPU percent usage.It runs perfect in W20...

If _beginthreadex fails, can I call it again for the same thread?

100 byte By ameliaj8 at 2007-11-25 11:12:04
Is there any issue with calling _beginthreadex more than once for the same thread until it succeeds?

Two threads running the same code at different speeds

1364 byte By MarkRMSheppard at 2007-11-25 11:10:21
I have a processor intensive application that breaks up it's work into different scenarios that are processed on two threads to make maximum use of the processor - a Pentium D (which has a dual core).However, I'm finding that sometimes the two threads run at vastly different speeds (i.e. o...

2 threads vs 1 queue

438 byte By cpplinux at 2007-11-25 11:09:32
Hello,I'm looking for a small and clear example in c++ of 2 threads that are using the same queue. The queue is the one of the c++ STL library. Program 1 pushs requests in the queue and program 2 get these requests and process them.Do I need to lock the queue when one of the threads is using it...

(OpenMP, C++ME, System.Threading.Thread) -> Resource Leak.

1282 byte By Pimp_Daddy at 2007-11-25 11:06:47
Here is the source code of my C++/ME app. When I run it I can use "Windows Task Manager" to see that thread HANDLEs are leaking.#include "stdafx.h"#include <omp.h>public __gc class TestClass{public: void ThreadProc() { int sum = 0; #pragma omp parallel for reduction(+:sum) for ( int i = 0; i...

Multi-threading without locks

969 byte By DeepT at 2007-11-25 11:04:08
I have two threads, one of them needs to run as fast as possible(because timing is very important) while the second thread is an expensive thread to run.The problem is that thread 1 and thread 2 have some objects in common. Traditionally I would just lock the object before using it. The issue w...

Thread ,schedule

131 byte By Abalfazl at 2007-11-25 11:02:47
Hello !<br/>It is said:<br/>"The basic unit of schedule is generally the thread"<br/>May someone explian about this?

what are the possible outputs

485 byte By avi123 at 2007-11-25 10:52:33
Hi,Suppuse I have the following functionstatic int staticIntX = 2;int inc(){ staticIntX++; return staticIntX;}What are the possible outputs for this function if 2 different threads are calling it?I understand that there are 3 possible answers:2,22,33,3the thing is that I do no...

Monitor an application - kill and regenerate if hang

472 byte By Yijie at 2007-11-25 10:51:58
Hi all,Do need a favour here. I would like to monitor an application and kill it if it is hang and regenerate it. However, not able to find relevant code. I'm able to get the kernel and user time by "getprocesstime". But not able to monitor the CPU usage (not able to get idle time) to kill the...

Is this way of writing thread correct?

766 byte By chee0007 at 2007-11-25 10:50:23
Hi guysFrom what i have learnt, a static function cannot reference to outside variables directly except variables that is declared inside the static function itself. So by calling another function that actually do all the thread procedures, I can change and manipulate variables directly without usin...

multiple core CPU and threads

270 byte By Red Squirrel at 2007-11-25 10:47:42
By default, do multithreaded apps in windows/linux take advantage of multiple cores? So if I run an app that has 2 threads, will they balance out on separate cores (assuming they're equally used at that point) Or do apps have to be written specifically for this?

trying to make thread class

1853 byte By Red Squirrel at 2007-11-25 10:46:19
I'm trying to make a thread class for easy implimentation when writing programs, this is my code: namespace RSlib{ class RSthread { private: bool running; //set to true when thread is started, and set to false when stopped int thr_id; // thread ID for the newly created thread p...

Critical_section

631 byte By indiana_pippis at 2007-11-25 10:42:52
Hi, I have a problem using the CRITICAL_SECTION: I have a thread that access to a list locking a criticalsection, the data are inserted in the list intercepting a message coming from a popup menu, the problem is that when the function try to add an element in the list and the critical section is loc...

ON Thread,Process,Task and Event

199 byte By visame at 2007-11-25 10:42:44
In Visual C++ Programming,these 4 concepts confused me:<br/>Thread,Process,Task and Event<br/>What is the difference between them?<br/>What books should I read and reference to?<br/>THANKS!

problem with multithreading and wrapper-class objects

1586 byte By Ky. at 2007-11-25 10:41:48
Hi guys,Im not sure I am using the corect terminology, since Im pretty new to MFC programming. Sorry for that.I created an object of a wrapper-class from an OCX libray (included with class _myObjectClass : public COleDispatchDriver).As opposed to other classes in this library and what "OCX" suggests...

monitor threads tools?

97 byte By aneird at 2007-11-25 10:40:34
There are no such tools that monitor threads?<br/>can i khow which thread is higher by thread id?

What is the difference between CreateThread and beginThreadex

833 byte By stephenprogrammer07 at 2007-11-25 10:30:02
I noticed some code examples use _beginthreadex or beginthread.I have been using CreateThread All this time. What is the difference between the 2 ? uintptr_t _beginthread( void( *start_address )( void * ), unsigned stack_size, void *arglist );uintptr_t _beginthreadex( void *security, uns...

Understanding Threading

390 byte By justin2021 at 2007-11-25 10:28:38
I'm having a really hard to trying to understand threading. It seems that all the sites I've been to trying to comprehend it, do it all differently. Is there any 1 easy, normal way to do threading? Maybe there's some things I should read up on before I get into it? I really want to un...

label caption poperty is not working properly

496 byte By Debasis Bag at 2007-11-25 10:27:53
Dear sir,I have developed a routine in my package that is When I going to carry forward data from current year to next year. My Progress Bar is working properly but Label Capion property is not displaying of the carry forwared records.Actually, I keep the label control in Do While Loop And wanted to...

How Do I send Parameters to a Thread in Motion?

2221 byte By stephenprogrammer07 at 2007-11-25 10:26:50
Hi I am trying to figure out how to pass a parameter to a Thread . Specifically char*. I might not be explaining correctly, so here are some snippets of my code. My main looks like thisint main(){ ThreadManager tm; tm.launchThread (&tm); while(...

monitoring completion of threads

4541 byte By stephenprogrammer07 at 2007-11-25 10:20:19
Hi ; I tried asking this question in another section and didn't find the answers useful to solving this problem . So I'll post it hear and hope I get luckier. I need to launch a thread and monitor when it ends before launching another thread. If the new thread is launched before the old t...

Is this safe? (double-checked locking)

1855 byte By Hermit at 2007-11-25 10:19:13
Hey folks,Suppose I have one thread which constantly reads from a structure and another which only occasionally modifies it. Since the reading thread is performance critical, I'd rather not have to acquire a lock every time the structure is read, so I've come up with the following strategy...

MFC CMutex issues

1066 byte By mmingfeilam1 at 2007-11-25 10:18:29
Hi, My company is writing a test harness in MFC to test out the Cantata telephone switch. we keep on running into issues when we are running the test harness with a lot of threads, ie >=40 threads. Attached is a screen shot of the assertion error that keeps on popping up. It complains about C...

Threading Question: How can I know when thread Ends?

2597 byte By stephenprogrammer07 at 2007-11-25 10:11:49
Hi I have a thread in my code. My thread code is similar to the thread format seen below - but it does a number of things and holds on to critical resources. My thread actually does microsoft speech - each thread says a new phrase. In testing, I discovered, that I absolutely have to wait until my...

Multi-threaded in multi-processor

353 byte By chee0007 at 2007-11-25 10:06:52
Hi,I am new to multi-threading, and with our present technology with dual core processors, what kinds of setup can optimise multi-threading efficently?Can visual c++ or .NET API programs running on Window XP/2K platform do multi-threading efficently on a multi-processor system(dual core) like what a...

Waking up a sleeping thread

169 byte By mdv at 2007-11-25 10:05:53
Hello,<br/>Is there a way to immediately wake up a thread that was put to sleep by calling the Sleep function with some big value?<br/>Thanks in advance. Denis

Unholy multithreading

1422 byte By shoppinit at 2007-11-25 9:59:00
Hi all, I'd appreciate your help with this one because I think I'm out of my depth!I've got 2 threads running in parallel, both using separate instances of a class (in theory) but the behaviour seems like both threads are accessing the same instance of the class. Everything works fine...

Thread function parameter

627 byte By alberthyc at 2007-11-25 9:57:35
i want to pass a struct as the parameter to my thread function.typedef struct tagTHREADPARMS {CWnd* pWnd;CEvent* pKillEvent;CEvent* pOutputEvent;CMultithreadingTestDlg* pDlg;//error here} THREADPARMS;i got plenty of syntax errors, such as:error C4430: missing type specifier - int assumed. Note: C++...

Multithreading and InternetOpen

264 byte By uaYola at 2007-11-25 9:51:24
Need to implement file downloading from internet using multithreading. May i call InternetOpen and InternetConnect in each of my threads or better to do it one time and use handle in different threads. How to do for BETTER PERFORMANCE?<br/>Thanks?<br/>PS. And why?

having problem with terminating a worker thread

1970 byte By alberthyc at 2007-11-25 9:50:28
hi, i wrote a mfc dialog that's running a worker thread i want to terminate it from outside.in CMyTestDlg: public CDialog{static bool STOP;//a shared variable to signal the thread functionstatic UINT __cdecl Start();CWinThread* pThread...in the cpp file, i have a OnBnClickedButtonStart() and O...

Stdout from multiple threads.

1165 byte By Czy at 2007-11-25 9:47:58
Hello,I've been stumped on this problem at work for a week. It is my first exposure to multithreaded C++ programming, and I am completely frustrated at how difficult it is to do something so simple.My task is to write a command-line test app for an API i have written (on a linux platform, RH7)...