 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 3652 Location: Belgrade
|
Posted: Thu Nov 29, 2007 11:57 am Post subject: Thread |
|
|
I would like to suggest making some internal thread API, that will be able to do some standard things with threads, like starting it, killing it & fire event when thread finishes.
I was experimenting a bit with threading APIs and messing with this generaly crashes AHK. Scan also noticed that launching more then 3 threads crahsed AHK always.
Directly from head, some syntax may look like:
| Code: |
Thread, id, Start, MyFunction, OnExit
Thread, Kill, ID
Thread, Supend/Resume, id
Thread, list, GetRunning
OnExit( ret_val ) {
} |
or in Function version:
| Code: | id := Thread_Start( "MyFunction", "OnExit")
Thread_Kill(id)
Thread_Suspend(id, true/false)
id_list := Thread_GetRunning()
|
This is one of the domains that can hardly be done succesifuly some other way, _________________
 |
|
| Back to top |
|
 |
Andreone
Joined: 20 Jul 2007 Posts: 257 Location: Paris, France
|
Posted: Thu Nov 29, 2007 1:25 pm Post subject: |
|
|
Some suggestions to go in your way: I think an internal thread API should include critical sections (and eventually semaphores) to protect against concurrent accesses.
Also, events require WaitForEvent . | Code: | ID := CriticalCreate([name])
CriticalEnter(ID, [Timeout])
CriticalLeave(ID)
CriticalDestroy(ID)
ID := EventCreate([name])
EventDestroy(ID)
EventFire(ID, [bool Reset])
EventReset(ID)
WaitForEvent, ID [,Timeout]
WaitForMultipleEvents, ID, [ID... ,Timeout] |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|