Fix C# binding thread-safety.
GitOrigin-RevId: 48b4ec74878f815d2a3d280a9f9f8a524509ab93
This commit is contained in:
parent
a56f70c340
commit
dea5dea49a
@ -213,7 +213,7 @@ EOT
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
EOT;
|
EOT;
|
||||||
foreach ($known_fields as $name => $type) {
|
foreach ($known_fields as $name => $type) {
|
||||||
$full_doc .= '\r\n /// <param name="'.$this->getParameterName($name, $class_name).'">'.$info[$name]."</param>";
|
$full_doc .= "\r\n /// <param name=\"".$this->getParameterName($name, $class_name).'">'.$info[$name]."</param>";
|
||||||
}
|
}
|
||||||
$this->addDocumentation($full_constructor, $full_doc);
|
$this->addDocumentation($full_constructor, $full_doc);
|
||||||
}
|
}
|
||||||
|
@ -527,9 +527,7 @@ class TlWriterDotNet : public TL_writer {
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
ss << "{\n";
|
ss << "{\n";
|
||||||
ss << " CallFromUnmanaged<" << class_name << "^> res;\n";
|
ss << " return DoFromUnmanaged<" << class_name << "^>(from);\n";
|
||||||
ss << " downcast_call(from, res);\n";
|
|
||||||
ss << " return CallFromUnmanagedRes<" << class_name << "^>::res;\n";
|
|
||||||
ss << "}\n";
|
ss << "}\n";
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
|
@ -100,30 +100,21 @@ auto CLRCALL FromUnmanaged(td::td_api::object_ptr<T> &from) -> decltype(FromUnma
|
|||||||
return FromUnmanaged(*from.get());
|
return FromUnmanaged(*from.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ResT>
|
template <class ResT, class T>
|
||||||
ref class CallFromUnmanagedRes {
|
inline ResT DoFromUnmanaged(T &from) {
|
||||||
public:
|
ResT res;
|
||||||
static property ResT res;
|
downcast_call(from, [&](auto &from_downcasted) {
|
||||||
};
|
res = FromUnmanaged(from_downcasted);
|
||||||
|
});
|
||||||
template <class ResT>
|
return res;
|
||||||
struct CallFromUnmanaged {
|
}
|
||||||
template <class T>
|
|
||||||
void operator()(T &val) const {
|
|
||||||
CallFromUnmanagedRes<ResT>::res = FromUnmanaged(val);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline BaseObject^ FromUnmanaged(td::td_api::Function &from) {
|
inline BaseObject^ FromUnmanaged(td::td_api::Function &from) {
|
||||||
CallFromUnmanaged<BaseObject^> res;
|
return DoFromUnmanaged<BaseObject^>(from);
|
||||||
downcast_call(from, res);
|
|
||||||
return CallFromUnmanagedRes<BaseObject^>::res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BaseObject^ FromUnmanaged(td::td_api::Object &from) {
|
inline BaseObject^ FromUnmanaged(td::td_api::Object &from) {
|
||||||
CallFromUnmanaged<BaseObject^> res;
|
return DoFromUnmanaged<BaseObject^>(from);
|
||||||
downcast_call(from, res);
|
|
||||||
return CallFromUnmanagedRes<BaseObject^>::res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// to unmanaged
|
// to unmanaged
|
||||||
|
Reference in New Issue
Block a user