flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 09 Apr 2010, 13:06
asmcoder wrote: because i cant guarantee that reader and write will be in diffrent threads. |
|||
![]() |
|
a115433 09 Apr 2010, 13:19
i use events to queue io completion events.
wich thread respond first - will queue completion event and wait on it. when its signaled, it will jump to my code and do something else, for example read another portion and queue its completion event, or end reading and return waiting. first i do init stuff with main thread (like allocating heap), then i enumerate cpus, then i create suspended threads for each, then i pass thread handles to each so when 1 die i detect it, i resume them and start waiting on input source, usually pipe, socket, or message. at the end i kill main thread just to keep things simple. remember i want to take advantage of everything os has to offer (with concern for backward compatibility, win 2000 missing = doesnt exist for me at all). |
|||
![]() |
|
revolution 09 Apr 2010, 13:29
You don't have to match threads to CPUs. Let the OS work it out.
You did state you "want to take advantage of everything os has to offer" so use it to mange the threads for you, don't go micromanaging something that the OS already has the code for. You are free to create as many threads as you please, so you can always guarantee a separate thread for read and write (if that is what you want) and then you can use mutexes, or critical sections, or semaphores, or whatever else the OS has to offer. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.