开发者

sharing XPObject object between threads

开发者 https://www.devze.com 2023-01-25 21:11 出处:网络
I am evaluating XPO, so far so good, really like it. I have a background thread do monitoring a directory, when it find a new file is added it par开发者_StackOverflowse the file name, and store this

I am evaluating XPO, so far so good, really like it.

I have a background thread do monitoring a directory, when it find a new file is added it par开发者_StackOverflowse the file name, and store this object to datastore and then fire an event with the object as arg, and i handle this event on ui thread through invoke, and on UI thread i need change the state of the XPObject, how can i do this to make sure thread safe? fire an event with Oid of the XPObject? and on UI thread try to grab the object from db and process on it, this seems a little stupid design if have million objects.

Any suggestion?


The most correct solution is to pass Oids of the required objects to the UI thread and process them separately.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号