Thread.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Thread" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. A unit of execution in a process.
  5. </brief_description>
  6. <description>
  7. A unit of execution in a process. Can run methods on [Object]s simultaneously. The use of synchronization via [Mutex], [Semaphore] is advised if working with shared objects.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="get_id" qualifiers="const">
  15. <return type="String">
  16. </return>
  17. <description>
  18. Returns the current [code]Thread[/code]s id, uniquely identifying it among all threads.
  19. </description>
  20. </method>
  21. <method name="is_active" qualifiers="const">
  22. <return type="bool">
  23. </return>
  24. <description>
  25. Returns true if this [code]Thread[/code] is currently active. An active [code]Thread[/code] cannot start work on a new method but can be joined with [method wait_to_finish].
  26. </description>
  27. </method>
  28. <method name="start">
  29. <return type="int" enum="Error">
  30. </return>
  31. <argument index="0" name="instance" type="Object">
  32. </argument>
  33. <argument index="1" name="method" type="String">
  34. </argument>
  35. <argument index="2" name="userdata" type="Variant" default="null">
  36. </argument>
  37. <argument index="3" name="priority" type="int" default="1">
  38. </argument>
  39. <description>
  40. Starts a new [code]Thread[/code] that runs "method" on object "instance" with "userdata" passed as an argument. The "priority" of the [code]Thread[/code] can be changed by passing a PRIORITY_* enum.
  41. Returns OK on success, or ERR_CANT_CREATE on failure.
  42. </description>
  43. </method>
  44. <method name="wait_to_finish">
  45. <return type="Variant">
  46. </return>
  47. <description>
  48. Joins the [code]Thread[/code] and waits for it to finish. Returns what the method called returned.
  49. </description>
  50. </method>
  51. </methods>
  52. <constants>
  53. <constant name="PRIORITY_LOW" value="0">
  54. </constant>
  55. <constant name="PRIORITY_NORMAL" value="1">
  56. </constant>
  57. <constant name="PRIORITY_HIGH" value="2">
  58. </constant>
  59. </constants>
  60. </class>