General Programming |
Author |
Message |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Dec 04, 2006 10:55 am Post subject: |
|
|
CreateThread and parameters?
"Is there a way to pass multiple parameters to the thread, instead of using global values?" |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Tue Dec 05, 2006 1:36 am Post subject: |
|
|
JoS: CPU at 100% but no benefit from 2 processors
"For example, on some test data, running them serially takes 49
seconds, while running in parallel takes 46-47 seconds. In the first case,
one processor is maxed out at 99%; in the second, TWO processors are
maxed out at 99% -- yet they take the same amount of time for the
same work!!" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Dec 14, 2006 9:13 am Post subject: |
|
|
C Board: _beginthreadex does not complile
"The multithreaded CRT is thread-safe, so _beginthreadex is in there,
but because you're compiling a debug build, the memory debug functions
are nowhere to be found.
MTd refers to... tada... the multithreaded debug CRT!" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Thu Dec 14, 2006 4:22 pm Post subject: |
|
|
CodeGuru: Function Static Variables in Multi-Threaded Environments
"This essentially means that the function will be anything but thread safe. One
very simple way to do this interlocking is to use the InterlockedCompareExchange()
function, which is guaranteed to be a synchronized operation." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jan 10, 2007 6:31 pm Post subject: |
|
|
CodeGuru: Simplified One-Time Initialization in Windows Vista
"For code that attempts to be clever and minimize the number of locks
taken out to guard the consistency of data structures accessible from
multiple threads, the x86 memory model provided a level of safety by
guaranteeing that all write operations occurred in order. This guarantee
does not hold true with the 64-bit processors, and code that reads data
without the protections of locks can experience unexpected results caused
by the processor reordering instructions." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Tue Jan 16, 2007 5:51 pm Post subject: |
|
|
CodeGuru: Framework for Writing Services and Multithreaded Applications
"I recently started a home project developing a set of middleware tools I am
hoping to flog on the Internet. Part of this involved writing NT services and
lightweight server side multithreaded applications. While doing this, I got a
little sidetracked (as I often do when time permits) and decided to knock up
a generic framework for things I find myself (re)writing frequently." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Wed May 02, 2007 5:38 pm Post subject: |
|
|
cboard: Need help in Threading in win32
"The rule of thumb is simple: use _beginthreadex if you use any part of the C
or C++ standard library, CreateThread otherwise. Since you use the standard
library for a few things almost implicitly in C++, just always use _beginthreadex.
Better yet, use Boost.Thread." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jun 17, 2007 11:21 am Post subject: |
|
|
JoS: Avoiding contention for the heap
"I was wondering if anyone could recommend any books, articles, or
web pages that address the topic of heap management in the context
of a multithreaded application." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Tue Sep 11, 2007 11:34 am Post subject: |
|
|
JoS: How are OS threads implemented?
"But I've always wondered how threads are implemented, at the OS level.
From the perspective of the programs I wrote, everything executed sequentially,
without any interruption. But, from the perspective of the operating system
(and the CPU), any arbitrary code might be scheduled right in the middle of
my code, between any of my instructions." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Oct 18, 2007 8:16 pm Post subject: |
|
|
RC: Win32 user interface work is inherently single-threaded
"You can push work to a background thread all you want, but once you send
a message to the window (or do something that results in a message being
sent to the window), you've given control to the UI thread." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Mon Jul 28, 2008 4:47 pm Post subject: |
|
|
RC: How can SIGINT be safely delivered on the main thread?
"Commenter AnotherMatt wonders why Win32 console programs deliver
console notifications on a different thread. Why doesn't it deliver them on
the main thread?
Actually, my question is the reverse. Why does unix deliver it on the main
thread? It makes it nearly impossible to do anything of consequence inside
the signal handler." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Apr 12, 2009 3:08 am Post subject: |
|
|
Marcus Zarra - Cocoa Tutorial: NSOperation and NSOperationQueue
"Fortunately, Apple has made a lot of progress in OS X 10.5 Leopard. NSThr-
ead itself has received a number of very useful new methods that make thr-
eading easier. In addition, they have introduced two new objects: NSOpera-
tion and NSOperationQueue. In this Tutorial I will walk through a basic exam-
ple that shows how to use these new Objects and how they make multi-thr-
eading your application nearly trivial." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Thu Apr 30, 2009 7:04 pm Post subject: |
|
|
Ilya Martinov - volatile and threading
"It looks like if you put locks around global variables shared between
threads you shouldn't care about volatile flag. Definitely under POSIX
threads and most likely when using other threading libraries as well." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Aug 11, 2009 7:06 pm Post subject: |
|
|
so - Reccomended thread layer to use for iPhone development?
"The problem I have is that I need another thread to block until an update
occurs... How can I make the main application thread block until at least one
CoreLocation update occurs? Is their an NSConditionVariable?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Aug 15, 2009 6:04 pm Post subject: |
|
|
adc - Porting Multithreaded Applications from Win32 to Mac OS X
"Mac OS X offers application-level multithreading support in three different
API packages:
* POSIX threads, or pthreads
* Cocoa threads
* Carbon Multiprocessing Services
The Win32 multithreading API does not have a native implementation of
condition variables. There have been many implementations of the condi-
tion variable model using available Win32 synchronization tools such as
events. The pthreads library contains a native implementation of condition
variables. While condition variables are still complex in nature, the fact that
they are supported natively in the library could help you simplify difficult
synchronization code." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Thu Aug 27, 2009 3:49 pm Post subject: |
|
|
so - Overhead of pthread mutexes?
"I'm trying to make a C++ API (for Linux and Solaris) thread-safe, so that
its functions can be called from different threads without breaking internal
data structures. In my current approach I'm using pthread mutexes to pro-
tect all accesses to member variables." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Thu Aug 27, 2009 3:55 pm Post subject: |
|
|
so - iPhone: multitasking, multithreading?
"Multithreading will work. It's multitasking that won't. The iphone won't let
more than one third party application run at once. That reasoning makes
fork live outside of the application's sandbox." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sat Aug 29, 2009 7:40 pm Post subject: |
|
|
so - How to kill a Thread with Objective C?
"The correct way to stop your thread executing is to ask it nicely to stop exe-
cuting. Then, in your thread, you listen for such requests and obey them at
an appropriate time." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Nov 16, 2009 4:15 pm Post subject: |
|
|
MF - Simple Multithreading design
"I have an app that loops through each pixel of an image and calculates
the data at that point. Each pixel is completely independent of the others,
so there shouldn't be any synchronization issues." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Thu Dec 22, 2022 12:02 am Post subject: |
|
|
MS - Multithreading with C and Win32
"All versions of the CRT now support multithreading, with the exception of
the non-locking versions of some functions. For more information, see
Multithreaded libraries performance. For information on the versions of the
CRT available to link with your code, see CRT library features." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
|