I've got an application that uses Pthread to do threading. Mostly Im using
Condition Variables and the associated function calls:
- pthread_cond_wa it()
- pthread_cond_si gnal()
- pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we
can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement
Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides
PThread) was the function PulseEvent ... but the MS documentation says that
function is not reliable and should not be used.
Thanks in advance for any help,
neal 10 5516
"noleander" <no*******@disc ussions.microso ft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com... I've got an application that uses Pthread to do threading. Mostly Im using Condition Variables and the associated function calls:
- pthread_cond_wa it() - pthread_cond_si gnal() - pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides PThread) was the function PulseEvent ... but the MS documentation says that function is not reliable and should not be used.
Thanks in advance for any help,
First the disclaimer: I know nothing of 'nix, 'nux and 'pux.
If however, you are willing to consider buying some help, you can look at
Services for Unix: http://www.microsoft.com/technet/int...pthreads0.mspx
which I believe has support for Posix Threads.
In addition, native Windows has support for mutexes, semaphores, events and
critical sections ( check the docs for CreateMutex(), CreateSemaphore (),
CreateEvent() and InitializeCriti calSection() ). You should be able
implement the missing pthread calls with a handful of these synchronization
services.
Regards.
Will
William DePalo [MVP VC++] wrote: "noleander" <no*******@disc ussions.microso ft.com> wrote in message news:9C******** *************** ***********@mic rosoft.com... I've got an application that uses Pthread to do threading. Mostly Im using Condition Variables and the associated function calls:
- pthread_cond_wa it() - pthread_cond_si gnal() - pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides PThread) was the function PulseEvent ... but the MS documentation says that function is not reliable and should not be used.
Thanks in advance for any help,
First the disclaimer: I know nothing of 'nix, 'nux and 'pux.
If however, you are willing to consider buying some help, you can look at Services for Unix:
http://www.microsoft.com/technet/int...pthreads0.mspx
which I believe has support for Posix Threads.
And which appear to be free. http://www.microsoft.com/windowsserv...s/default.mspx
-cd
Thanks for the suggestions.
I tried SFU a few months ago and I had two problems with it: (1) im using
Standard Vis C++, and I think it required me to buy the more expensive
edition; and (2) it was _huge_.
I'm looking for just a little wrapper around the native Windows thread
library that emulates the pthread Condition Variable functions.
I've read the Pthread (for Windows) source code, and it is rather elaborate
.... I was hoping someone has created a stripped-down, simple wrapper that
does condition variables.
"Carl Daniel [VC++ MVP]" wrote: William DePalo [MVP VC++] wrote: "noleander" <no*******@disc ussions.microso ft.com> wrote in message news:9C******** *************** ***********@mic rosoft.com... I've got an application that uses Pthread to do threading. Mostly Im using Condition Variables and the associated function calls:
- pthread_cond_wa it() - pthread_cond_si gnal() - pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides PThread) was the function PulseEvent ... but the MS documentation says that function is not reliable and should not be used.
Thanks in advance for any help,
First the disclaimer: I know nothing of 'nix, 'nux and 'pux.
If however, you are willing to consider buying some help, you can look at Services for Unix:
http://www.microsoft.com/technet/int...pthreads0.mspx
which I believe has support for Posix Threads.
And which appear to be free.
http://www.microsoft.com/windowsserv...s/default.mspx
-cd
"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. And which appear to be free.
http://www.microsoft.com/windowsserv...s/default.mspx
Who woulda thunk that! :-)
Regards,
Will
"noleander" <no*******@disc ussions.microso ft.com> wrote in message
news:E1******** *************** ***********@mic rosoft.com... Thanks for the suggestions.
You are welcome.
I tried SFU a few months ago and I had two problems with it: (1) im using Standard Vis C++, and I think it required me to buy the more expensive edition;
Well, I don't know if that is true but if you post information on whatever
it was that you could not do with the standard edition, someone will likely
be able to confirm that or explain why it is not so.
and (2) it was _huge_.
Well, Windows ain't 'Nix. :-)
Regards,
Will
"noleander" <no*******@disc ussions.microso ft.com> wrote in message
news:E1******** *************** ***********@mic rosoft.com... I've read the Pthread (for Windows) source code, and it is rather elaborate ... I was hoping someone has created a stripped-down, simple wrapper that does condition variables.
Underlying that wish is the assumption that the wrapper ought to be simple.
At this link you'll find a paper on synthesizing condition variables under
Win32: http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
It contains this line
<quote>
This article illustrates why developing condition variables on Win32
platforms is tricky and error-prone
</quote>
Were I you in your shoes, I might be tempted to use what the author has to
offer here: http://www.cs.wustl.edu/~schmidt/ACE.html
if the licensing terms (which I did not research) are acceptable, regardless
of perceived lack of simplicity. Just my opinion, YMMV.
Regards.
Will
On Wed, 1 Jun 2005 19:04:14 -0700, noleander wrote: I've got an application that uses Pthread to do threading. Mostly Im using Condition Variables and the associated function calls:
- pthread_cond_wa it() - pthread_cond_si gnal() - pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides PThread) was the function PulseEvent ... but the MS documentation says that function is not reliable and should not be used.
Thanks in advance for any help, neal
Here's a good paper on the subject:
Strategies for Implementing POSIX Condition Variables on Win32 http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
--
Doug Harrison
Microsoft MVP - Visual C++
Thanks for that article ... it looks like it fits my needs exactly.
Here is another article I just found that has some similar suggestions, tho
not couched in "condition variable" terminology: http://www.codeproject.com/threads/semaphores.asp
Thanks again!
"Doug Harrison [MVP]" wrote: On Wed, 1 Jun 2005 19:04:14 -0700, noleander wrote:
I've got an application that uses Pthread to do threading. Mostly Im using Condition Variables and the associated function calls:
- pthread_cond_wa it() - pthread_cond_si gnal() - pthread_cond_br oadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we can only use Native Win32 threading/mutex functions.
Question: Does anyone out there have any suggestion on how to implement Condition Variables with Native Win32 functions?
I researched this in the web, but the only thing I could find (besides PThread) was the function PulseEvent ... but the MS documentation says that function is not reliable and should not be used.
Thanks in advance for any help, neal
Here's a good paper on the subject:
Strategies for Implementing POSIX Condition Variables on Win32 http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
-- Doug Harrison Microsoft MVP - Visual C++ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: adsheehan |
last post by:
Does anyone know how to determine the pthread or native thread
identifier while in Python ?
FYI I have a multi-threaded C++ app on Solaris that embeds the Python
interpreter. While in the interpreter I need to determine its actual
running thread id.
FYI2 The python interpreter is not firing off extra threads via the
python threading classes etc.
|
by: lokb |
last post by:
Hi,
I am creating a detach thread as shown below and caling pthread_create in
a while loop where the file names in the directory are fetched and is
passed as a parmater to pthread create. The apilcation is running fine
except for the sleep cycle.
My sleep cylce is sleep(5) which is halting all the threads created from
execution. What i need here is the main thread creating the pthread should
only sleep but not all the threads created.
Is...
|
by: nan.li.g |
last post by:
Hello, all,
I have an interesting problem about stl map and pthread on Linux
and g++. The source code is as follows.
//mt_map_test.cpp
#include <string>
#include <map>
#include <unistd.h>
#include <sys/types.h>
|
by: david wolf |
last post by:
The following pthread code cannot compile, I want to know why. Can
somebody give me direction on this?
if I replace the following line of code
status1 = pthread_create(&threadID1, NULL, read, NULL);
with:
status1 = pthread_create(&threadID1, NULL, readerWriter::read, NULL);
|
by: fran |
last post by:
Server: IBM XSERIES 225 (Intel Xeon CPU 2.40GHz 1GB RAM)
Operating System: Linux RedHat ES 2.1 kernel 2.4.9
Languaje: C++
Compiler: gcc 2.96
Libs: pthread
We are in need of your help in order to solve the folowing problem:
We´re working on a server side application that implements threads
(pthread under linux Red Hat ES 2.1 kernel 2.4.9). The problem seems
| |
by: chuckles |
last post by:
Hullo all, as the subject says Does pthread emit a sigchld signal on
successful exit?
I have an app which starts a thread in response to a button press in a
GUI. I can't join the thread but I need to know when it completes. The
time it takes for the thread to complete is variable and I don't want
to have to poll the thread for completion. I would like to avoid having
to use condition variables, so I thought setting up a signal handler to...
|
by: Claudio Grondi |
last post by:
Sometimes it is known in advance, that the time spent in a loop will be
in order of minutes or even hours, so it makes sense to optimize each
element in the loop to make it run faster.
One of instructions which can sure be optimized away is the check for
the break condition, at least within the time where it is known that the
loop will not reach it.
Any idea how to write such a loop?
e.g.
|
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in C# in some
way? Or maybe no, because it is similar to a global variable (with its
scope restricted) which C# is dead against?
Zytan
|
by: Chris M. Thomasson |
last post by:
FWIW, here is a quick example (in the form of a fully compliable program
with error checking omitted) of how I use POSIX threads within a C++
environment:
_________________________________________________________________
/* Simple Thread Object
______________________________________________________________*/
#include <pthread.h>
extern "C" void* thread_entry(void*);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |