winforms - Will this implementation using TPL work inside a process running on an STA thread? -


i want create instance of object assembly implements interface define in forms app. create object @ app startup using activator.createinstance, , keep application-level reference it.

at points during application want call methods on object without holding main thread using task.run(() => imyobject.dosomework(somelist, somelist2)). want make "fire , forget" void method call , don't need await or register callbacks.

will fact app running in sta thread pose issue? have worry leaks or premature collection of objects instantiate on main thread , reference inside task closure? intend read contents of these lists, not modify them.

no need worry; create delegate, objects references kept in memory, @ least until task.run exits. there's nothing sta thread changes that.

threads don't factor gc @ - except stacks running threads contain root objects. can cross-reference objects want , won't confuse gc.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -