>Jason Sage wrote: > Hi all - and thanks to who ever can respond in advance. > > > > I have a Server Like App - I need the equivalent of sched_yield > >Tried sleep(0); yet ? > > > Micha
Yes. Sleep has been added where appropriate. I didn't know to try Sleep ZERO. That sounds better than my Sleep(10). Thank You for that suggestion. I was trying to avoid sysutils sleep(0) in linux platform due to the size of sysutils. The fact I don't know how to make dynamic linking work on linux yet - (use shared libs versus static) makes my exe's bigger than I would like. In most of my applications, size isn't an issue - but in one in particular - it is everything. Using shared linking in linux, which I think is possible, would make for less overhead for the operating system to invoke each instance of this (ideally) small as possible application. This "small" app is fired often, simultaneously, and load/execute/terminate time is critical but needs to yield when its not busy. The YIELDING part works. Thank You. On this note, for size reasons, in win 32 I use the Win32 API call that does the same thing as sysutils sleep. This is what promprted my question - to call the operating system (in linux I guess its sched_yield) "sleep" directly. In another area around CPU yielding - and multithreading.... What I have learned since I wrote this question is that sleep (and sched_yield) is not an appropriate means to get different "threads" a timeslice, which was my impression. I THINK that sleep refers to releasing or yielding your entire application to other tasks the operating system is handling. Which means its use should be minimal, and strategic - like when you application true "should" release the CPU a bit... or is "truly" idle. You see I have been playing with TThread - and I noticed that the most currently launched thread is the one who stays running - and everything else in my app stops until it finishes. This leads me to believe I am responsible for managing what threads runs when - whether timeslices, "loop counters" inside the thread - (I ran four iterations - you can suspend me again) ... or some sort of mechanism. I believe TThread.Syncronize and possibly TThread Critical Section are going to be my next area of experimentation. Along this lines I have changed the entire "main loop" architecture of my bigger THREADING application - to work similar to how Lazarus makes its executables or how a windows program works in win32 - I've built a messaging system - that is a COMMON construct throughout all my classes, so that they can ALL communicate in a context-less way to the main program - allowing the main program to respond by suspending, resuming, terminating... etc any/all of the working threads as it deems correct. Thank You For Your Response Micha. Any and all help is always appreciated. Jason P Sage _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal