The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Multi-Threading
Posted: 17 Oct 06 11:39 AM
|
fiogf49gjkf0d I know that SLX is a single-threaded application, but was wondering whether this limitation can be overcome using .NET extensions in V7? Or is a separate executable the way to go? |
|
|
|
Re: Multi-Threading
Posted: 18 Oct 06 4:19 PM
|
fiogf49gjkf0d Simple answer? No. I believe that even though the extension itself may be multi-processor aware, I think the application that calls it has to be multi-threaded as well.
A lot of the server code is multi-threaded. I believe the OLE DB Provider is, but I know for sure that the SyncService is. I doubt many of the core executables are multi-threaded but it appears that Sage is at least aware that they'll have to upgrade things eventually. It's inevitable that all applications will eventually be threaded, but that won't stop a lot of developers from dragging their feet. In their defense, it's never easy but at least the tools are getting easier to work with. |
|
|
|
Re: Multi-Threading
Posted: 18 Oct 06 4:58 PM
|
fiogf49gjkf0d When you say "SLX is a single-threaded application" what exactly do you mean? I am sure there are numerous parts of the application that use multiple threads (the provider certianly is threaded).
If you're referring to customizations you make in SLX, that is different. VBScript is script, not threaded in any way. You could however build customizations in .NET that work with SLX that is threaded (for *any* version of SLX, not just v7) |
|
|
|
Re: Multi-Threading
Posted: 19 Oct 06 4:18 AM
|
fiogf49gjkf0d Jeremy and Ryan - thank you for your responses.
My question was a little woolly - here is what we are trying to do.
We have a client that has an 'enter new account' process. Part way through the process, they would like us to submit some XML to a Java applet. After a few seconds (3-10), some info will be returned via XML by the applet and, depending on the info returned, a SQL update statement will be executed. However, rather than wait a few seconds, the client wants to be able to continue working while the other stuff happens in the background.
How would you guys do this? |
|
|
|
Re: Multi-Threading
Posted: 20 Oct 06 11:48 AM
|
fiogf49gjkf0d Hi Phil,
I've done this sort of thing often. You're best bet is to use something that will be completely out-of-process, insead of an in-proces COM exposed class (which could still work, just that then you also have to worry about object lifetime). An easy route, is to just create a window-less EXE and kick it off (pass whatever relevant values to it on the command line or just set them in globals and pick those up from the EXE). Then it does it's work completely separate from SLX and then can update whatever records it needs to and even refresh or force SLX to navigate to whatever when complete. Know what I mean?
You could also create a COM exposed class in .NET and pass a reference to it back to SLX in a global and then use that in a script (even wire up events if needed to respond to the callbacks after the operation being performed by the .NET class completes.
-Ryan |
|
|
|
Re: Multi-Threading
Posted: 23 Oct 06 1:23 PM
|
fiogf49gjkf0d Originally posted by Phil Parkin
I know that SLX is a single-threaded application, but was wondering whether this limitation can be overcome using .NET extensions in V7? Or is a separate executable the way to go? |
|
I've yet to use .NET assemblies in v7 but I would think that you could create an instance of an object from the assembly that creates a new thread and runs your threaded process. That process could update a property on the .NET object. In SLX, you could use a timer to check until the property on the object changes to a specifc value (boolean or what not) or a specific time passes (time-out). I've done this without .NET and it works very well so I would assume it would work as I explained it. Anyone's feedback on this idea is welcome as it hasn't even been attempted by me yet. |
|
|
|
Re: Multi-Threading
Posted: 23 Oct 06 1:30 PM
|
fiogf49gjkf0d This certainly would work (and you wouldn't need just v7 for this, you could do this in any version of SLX) but one thing to be aware of is object lifetime. If you have an object that spawns a process on another thread and returns control back to the calling script, then the script will terminate and the object with the spawned thread will be destroyed. This is why you'd either want it out of process or ensure that the calling script's lifetime will match the lifetime for your object (or make sure the object has a larger scope than the script).
-Ryan |
|
|
|