Author |
Message |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sat Sep 03, 2005 4:07 pm Post maybe stupid Post subject: Threads! |
 |
|
|
|
OK, way back when I was first experimenting with the idea of putting the recv() calls of MERVBot in separate threads, catid said I would have to make a mutex for each plugin. I'm not sure if this is the case.
Here's my basic layout: Class Host "owns" all the loaded plugins. Code in Host, and therefore code in each plugin, is entered in four possible ways: either by the periodic doEvents() function call, the disconnect() function call, the destructor at the end of main(), or by the callback from the receiver loop. doEvents(), disconnect(), and the callback use a mutex. By time the destructor is called, the receiver thread has died.
Does anybody see any possibility for an instance of the plugin to be entered by two threads at once? _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Sep 03, 2005 4:49 pm Post maybe stupid Post subject: |
 |
|
|
|
Why even bother with this crap? Just make the socket non-blocking and do it synchronously. _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Sep 04, 2005 11:54 am Post maybe stupid Post subject: |
 |
|
|
|
Because WSAWaitForMultipleEvents() was using more time (with a 0ms delay) than any function other than main. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Sep 04, 2005 3:37 pm Post maybe stupid Post subject: |
 |
|
|
|
I've never used that function before. I just do:
socket()
connect()
ioctlsocket()
send()
recv()
closesocket() |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Sep 04, 2005 4:20 pm Post maybe stupid Post subject: |
 |
|
|
|
Yeah, I don't use it either (I try to stay away from MS extensions...) but catid was. I'm assuming you would just call recv() and then check for WSAEWOULDBLOCK? |
|
Back to top |
|
 |
Gravitron VIE Vet

Age:43 Gender: Joined: Aug 02 2002 Posts: 993 Location: Israel Offline
|
Posted: Sun Sep 04, 2005 4:30 pm Post maybe stupid Post subject: |
 |
|
|
|
Cyan, just accept the fact that you're a moron and this is over your head and stop bothering people with your problems.
Actually, go learn java and form the dorkclub with cerium. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Sep 04, 2005 8:36 pm Post maybe stupid Post subject: |
 |
|
|
|
Thanks for gracing my thread with your presence. |
|
Back to top |
|
 |
|