AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Thread

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
majkinetor



Joined: 24 May 2006
Posts: 3652
Location: Belgrade

PostPosted: Thu Nov 29, 2007 11:57 am    Post subject: Thread Reply with quote

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
View user's profile Send private message MSN Messenger
Andreone



Joined: 20 Jul 2007
Posts: 257
Location: Paris, France

PostPosted: Thu Nov 29, 2007 1:25 pm    Post subject: Reply with quote

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 Wink .
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group