From: SourceForge.net <no...@so...> - 2003-01-25 09:05:59
|
Feature Requests item #674367, was opened at 2003-01-25 00:39 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=674367&group_id=10894 Category: 80. Thread Package Group: None Status: Open Resolution: None Priority: 5 Submitted By: Markus Elfring (elfring) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: call for a function that is not thread safe Initial Comment: I describe an use case for the handling of unsafe functions calls with the thread package. I must assume that an application programming interface (like a graphics library or a music API) or even a single function is not thread safe if this property is not described in the documentation for that API. So I must ensure that all unsafe functions are executed by a single thread at each time. I want to create a thread for each function library that must be handled as it has not implemented thread safety at startup/initialization time of my application. I want to achieve that calls into different unsafe libraries can be executed simultaneously. I can perform the call with the function "thread::send" for a thread that has been created before. But I think that I will need a special kind of mutual exclusion. I understand the thread package's documentation in the way that a mutex that is created by the command "thread::mutex create" belongs to the calling thread. It may not be stored in a thread shared variable. Please correct me if I make wrong assumptions here. I guess that the function "thread::eval" does not all what I want and need here. It does not expect a thread indentifier in its argument list. I need a mutex that is global to the process scope (http://citeseer.nj.nec.com/cs?cs=1&q=synchronization+and+global+and+mutex&submit=Documents&co=Expected+Citations&cm=50&cf=Any&ao=Expected+Citations&am=20&af=Any ) to perform a protected and synchronous call of a code piece that should be executed by an other thread. I would like to suggest new functions like the following. 1. thread::mutex::create global or thread::mutex -global create 2. thread::safecall id global_mutex script ?varname? How do you think about this suggestion? Does this use case lead to add more synchronization primitives to the thread package? ---------------------------------------------------------------------- >Comment By: Markus Elfring (elfring) Date: 2003-01-25 10:10 Message: Logged In: YES user_id=572001 Values are only available globally with TCL threads if the data is stored in thread shared variables. (http://cvs.sourceforge.net/cgi- bin/viewcvs.cgi/*checkout*/tcl/thread/doc/html/tsv.html). So I adjust my suggestion for the function interface design. The identifier for the mutex object with the global scope must be accessed by a thread shared variable. 1. thread::mutex::create ?tsvname ...? 2. thread::safecall id tsvname script ?varname? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=674367&group_id=10894 |