VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "P4ConnectThread"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

' Simple class which does a P4Connect in a thread in case of long timeouts

Implements ThreadLaunch
Private m_Notify As Long

Private Function ThreadLaunch_Go(InputData As Variant, OutputData As Variant, ThreadSignalPtr As Long) As Long
    Dim SleepTime As Long
    Dim p4 As P4COM.p4
    
    ThreadSignalPtr = VarPtr(m_Notify)
    ThreadLaunch_Go = InputData
    
    OutputDebugStringA "Thread: Starting p4 connect"
    On Error Resume Next
    Set p4 = NewP4
    p4.Connect
    If err.Number <> 0 Then
        OutputData = "Fail"
    Else
        OutputData = "Success"
    End If
    OutputDebugStringA "Thread: Finished: " & OutputData
End Function

Private Function HaveBeenNotified() As Boolean
    HaveBeenNotified = m_Notify
End Function
