March 21st, 2013, 05:12 PM
I would like to press one button to fire several timed actions simultaneously. Each action will then run and end seperately according to its own code. I believe it could be done with BeginThread etc. Any idea how? Just designing some sort of game
April 9th, 2013, 04:14 AM
I/O and scheduling
User thread or fiber implementations are typically entirely in userspace. As a result, context switching between user threads or fibers within the same process is extremely efficient because it does not require any interaction with the kernel at all: a context switch can be performed by locally saving the CPU registers used by the currently executing user thread or fiber and then loading the registers required by the user thread or fiber to be executed. Since scheduling occurs in userspace, the scheduling policy can be more easily tailored to the requirements of the program's workload.
However, the use of blocking system calls in user threads (as opposed to kernel threads) or fibers can be problematic. If a user thread or a fiber performs a system call that blocks, the other user threads and fibers in the process are unable to run until the system call returns. A typical example of this problem is when performing I/O: most programs are written to perform I/O synchronously. When an I/O operation is initiated, a system call is made, and does not return until the I/O operation has been completed. In the intervening period, the entire process is "blocked" by the kernel and cannot run, which starves other user threads and fibers in the same process from executing.
<Mod edit: I'm keeping this reply, even though the poster is a no-good seo scum who is merely looking to increase his post count. FYI, he cut and pasted his reply from wikipedia on Threads and probably has no idea what he's talking about.>
Last edited by Scorpions4ever; April 19th, 2013 at 04:12 PM.
April 9th, 2013, 10:48 AM
Thank you for your technical answer which, unfortunately I don't really quite understand
Still, is there a simple solution?
I have four lights and currently, each one will only go on after each other, albeit microseconds, but still it is not instant.
Can I put them ALL on simultaneously?
Originally Posted by bullsforex
April 10th, 2013, 10:51 AM
The short answer to your question is no..
Originally Posted by sihaam
The reason is that only the MAIN thread of your application can manipulate the application's GUI. So if you were to create several threads to accomplish this task, each thread would have to synchronize with the main thread to make changes to the GUI, putting you right back where you started.
April 10th, 2013, 12:53 PM
Actually I found a free, simple yet dynamic component to do this job for me. Multi threading is a breeze.
Originally Posted by majlumbo